Skip to content

Tag: laravel-5.8

Update() in Laravel does not seem to be working

I’m working with Laravel 5.8 to develop my project and I have this table which shows some data from the DB: As you can see there’s a link named Edit for editing these data, so when someone clicks on that, this method runs: I have also added this form for updating the data sent to the edit.blade.ph…

pagination data with laravel 5.8

I´m traying to paginate my results of query, but i have a problem with this. I have this code in my controller: and in my view: but i have one error when render blade: i did a print_r and this it´s result: so that, i can show my post in my blog page, but when render blade i can´t show

Laravel – How to query Eloquent relationship?

I have this models in Laravel-5.8: Then I have this Query in Employee controller function: How do I include where is_active = 1 from employee_types into the query in Employee: Answer You are looking for the whereHas method, querying for the existence of a relationship: Laravel 5.8 Docs – Eloquent &#8211…

hasManyThrough – Laravel 5.8

I have database table structure like : ClassRoom id (int) PK name (varchar) ClassTeacherCourse id (int) PK id_classroom (int) FK id_teacher (int) FK id_course (int) FK Course id (int) PK course_name (varchar) Teacher id (int) PK teacher_name (varchar) So far I have code just to call ClassRoom table & Clas…

get a deeper element which satisfies the condition

Need to get the postal_code value, which is the value of long_name with types=postal_code. In the api result,it seems types itself is an array. Looping and finding out is a bad method. also array_search also don’t work. Can anybody help me. Answer Just loop through the array and find an item with the po…

Laravel how to create a seeder based on array

How can I create a laravel-seeder based on an array? I have an array like this: So instead of doing like this for each entry, I was hoping there might be another way to achieve that? Answer Option A) Option B) Note: Insert doesn’t automatically populate the timestamp columns.