Skip to content
Advertisement

Tag: eloquent

Multiline Eloquent query

I’m trying to filter my products based on selected filters and possibly a search term/word. My filters have a relationship with categories, which in their turn have a relation ship with my products. My code below only works (without the if statement checking for a search term/word) when everything is chained together, but when I try to break the query

How to use nested foreach loop in laravel for populating submenus?

I need to populate the menubar submenus using Laravel. Menus are populating but submenus are not working. This is my blade file. @foreach($categories as $c)

Resource Controller Concept

I am unable to find the issue. It is showing 404|Not Found update.blade.php PostController.php (a resource controller) route: please tell me what is the issue in this. one of the advice I got is to change the name of view file i.e update.blade.php to edit.blade.php. I don’t know how does it help Answer First you should change edit.blade.php instead of

Laravel select records with pivot table

I have a little problem with eloquent. I have 3 tables. Users, phrases, and phrase_user. phrase user contains columns: id, phrase_id, user_id I need to select phrases with pivot table for example. This action with SQL will be like this… This is my index function in controller I also have written these functions in models… Phrase model: User model: In

Advertisement