I’m trying to walk through as CSV file and extract all its contents. After the contents are imported I need to insert them into my mysql database table but before I can do that I need to check if these records exist. If a record does not, import this register. I’ve got headers and all content and I had created
Tag: laravel
I can’t add a column to a table with data in laravel
I’m doing this: create: Code: The migration runs without problems, but I am going to check the table and the column is not added, if I create a new migration and put a total to the new column, it says that the column already exists, what error is occurring? Answer go to the database table and delete the previous total
Laravel Resource controller
How do I tell my API to display a particular result based on another column? e.g. localhost:8000/api/gadgets/{{id}} Normally it returns the particular information of the specific gadget with that ID and localhost:8000/api/gadgets/{{imei_code}} does not return any value or an error whereas imei_code is a column that I needed to pass as a GET request… I’m using the normal resource controller
Surely noobie Laravel Question: Undefined id? Why? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question I’m trying to edit the data saved in my DB, and I’m completely lost. In my PostController the index, create,
Laravel 5.8: Weird Error Trying to get property ‘created_at’ of non-object
I’m using Laravel 5.8 to develop my project and in this project, I have a OneToMany relationship between Member Model & Student Model like this: Student.php: Member.php: Then at the Controller, I added this: Now at the view I want to get created_at timestamp like this: $customs->find($student->mbr_id)->created_at But this will return this error: Trying to get property ‘created_at’ of non-object
Select specific column from morph relation according to type in Laravel
I am trying to write a query that selects columns from a model then selects some columns from a morph relationship table. But I have no idea to select columns, and relation tables have different columns. So some column has no slug, some have. Models How can I select specific columns from morph relation with checking morph type? I am
Laravel migration shows column doesn’t exist for existing columns
I’ve written the above code in the up method of my migration but when running migrate command, it shows – Course table migration file I don’t have any idea why this error occurs because i’ve the userId column in my ‘course` table migration. Any help is much appreciated. EDIT Output: View Query Model Controller Answer Problem A. “column course.userid does
Laravel validate() method returns index html page when false
I’m building my first laravel API and when I try to validate some mock form data using Postman with POST method, the application returns to me the HTML of the index page and status 200. Here is my code The application returns the object that was inserted in the database if the validation was successful (if the data was filled
Relationship eloquent in laravel?
In user: In post: I handle in controller: Then I get an array and the result returned is exactly what I need. But when I query this way because I need to get a lot of data, the result is an empty array. What did I do wrong? In UserController.php: Please give me any comments. Answer You have to select
Lumen : using helper get error : Using $this when not in object context
I have create this helper in Helpers folder inside Http folder: when I call it in controller : it give me this error : Using $this when not in object context where I remove $this in function I get this error : Call to undefined function AppHttpHelperscheck_id() Answer check_id is a static function if you want to access it into