I’m started to write tests in Laravel. My application works, I can login, run migrations, but when I’m trying to test the login, I’m getting the following error: could not find driver (SQL: PRAGMA foreign_keys = ON;) My DB is in Postgres, and my test is as follows: I’m not worried (for…
Tag: laravel
MySQL (RDS) queries are running in my process list long after my scripts have finished
First up I know something is wrong fundamentally with the way I am running my queries. I would like to ignore the root cause of this and in this question just ask the following: I have a PHP script …
Print specific data to blade view
I can’t find how to print data on the blade.view. I have a list of “customers” on overview.blade.php, and I have a button that redirects to their profile based on their “nCustomerID” (which is blade….
When to use Repository vs Service vs Trait in Laravel? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. Improve this question To avoid code duplication in Laravel, I want to have a method that is …
How to use a resource collection toArray and DB (without Eloquent)
I have this query (in a repository, without using Eloquent): I have this controller: And at least, I have this collection: I have this error 500: “message”: “Call to undefined method stdClass::toArray()”, I think it is because I use the ‘DB’ facade instead of Eloquent. So h…
Unable to access uploaded files from axios request to laravel
I’m building the curriculum section for one project where multiple lectures in a section can have multiple files. I’m unable to send files to the Laravel controller. Vue form
htmlspecialchars() when print view
I get the error: htmlspecialchars() expects parameter 1 to be string, object given When print the view get the error, I don’t understand what is wrong in my code. I have print and object? How …
How to handle “unsupported_grant_type” from laravel passport
I’m playing around with laravel and try to enable client credentials grant to secure some api endpoints. To provide some context: I want to create an api that stands between a database and several websites (and SPAs). So I’ll be able to do some monitoring (what website/SPA calls which ressources) …
Invalid credentials adldap2/adldap2-laravel package
I am implementing LDAP authentication in laravel app. When I run this code I am getting an error. I don’t know whether it is correct or not. I am totally new to LDAP and I don’t know how it works by …
How to restrict a user to only see their own profile
I have a view (resources/view/front/auth/profile.blade.php) and my route in file web.php is: My problem is that when a user logs in and gets redirected to their own profile page (http://exmaple.com/profile/2), he/she can change the URL to http://exmaple.com/profile/3 and see other users’ profile. I want…