skip to Main Content

Laravel eloquent find in array of objects column

I have a table called services with multiple columns and one column named staff_assigned with this content: [{"user_id":"15549","price":"100"},{"user_id":"15548","price":"300"},{"user_id":"15552","price":"95"},{"user_id":"15553","price":"600"}] How can I find all services where user_id is 15548 with Laravel eloquent? Note that Service::where('staff_assign->user_id', "15548")->get(); doesn't work because column contains…

VIEW QUESTION

How to do laravel eloquent table with joins, orwhere and pagination correctly?

This is my original code where i display all data for team users. $data = Teamuser::join('teams', 'teams.id', '=', 'team_user.team_id') ->join('users', 'users.id', '=', 'team_user.user_id') ->get(['users.name as username','teams.name','users.email','team_user.role','team_user.id','team_user.user_id','team_user.team_id']); However, since im developing a search function for the table. I try adding orwhere…

VIEW QUESTION
Back To Top
Search