Relative Content

Tag Archive for phplaraveleloquent

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.

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.