Laravel Eloquent loadCount() with multiple same relations
It is possible to load count of relations for already fetched model, like that:
Auth::user() / auth()->user(), undefined method ‘update’
In my code am trying to update the information but I receive error as.
i have created a function to update data on logged in users but i am getting the error “undefined method ‘update'” even after i changed it to save() method.
Laravel ORM whereHas() and orWhere() filter not working
Currently I’m making a function that displays news
Compare against null (0000-00-00 00:00:00) datetime with Laravel Eloquent
Is there an elegant way to do compare against undefined datetime in Laravel Eloquent ORM?
laravel model event observer not firing during database seeding
i have a model event observer which fires fine when i manually create a model, but it does not fire whatsoever when seeding
Laravel Appending Attribute makes website crash
In the issue below i have many products which include gifts, I’m trying to create an attribute which returns a text the displays how many products to buy to get a gift and how many gifts you will be getting, although the logic is fairly easy, laravel crashes when appending this attribute and I can’t get my head why.
How to group by “year” list data into 12 months only
here is my code –
Laravel retrieve latest of many morphed results
I need help with my laravel 11 project. I have a table which acts as a morph table which would work with morphedByMany. But for this particular model I only need to retrieve one entry. My tables are: Site, Domain and then the intermidiate table: Siteable. Siteable defines the site_id, siteable_type and siteable_id columns. The following relationship defined at the Site model would retrieve all of my domains for the site, but a site should only have one domain:
Rating Calculation Issue for Internal and External Services in Laravel
I’m encountering a puzzling issue with calculating ratings for internal and external services in my Laravel application. I have two sets of code that retrieve services based on their type and then calculate ratings for these services. However, I’m getting inconsistent results, and some of the ratings are coming out as 0 when they shouldn’t be.
Laravel, $query, Trouble with Laravel Eloquent orderBy when sorting by related table column
I’m encountering an issue with Laravel Eloquent while trying to order query results by a column from a related table. Specifically, I have a recipes table and a related nutrients table, and I want to order recipes by the kcal column in the nutrients table.