I have logged as approver_id ='897'. Request table have request_id,approver_id
request_id approver_id
005 897
006 [897,91]
007 91
I want to fetch the records where $approver_id is 897
In a laravel query I have to get the row where the approver_id is 897 so expected 005 and 006
$user=".."; //Query stuff
$user=$user->where('request.flag','=','1')
->orwhereIN('asset_request.approver_id',array($approver_id))->get();
I didn't get any rows how to check the approver_idis in the table row
i don't recommend to store information like this but if you need then store it as a json. And then you can fetch it like this
$requests = Request::whereJsonContains('approver_id',[$approver_id])->get();
Here Request
is a model class for requests
table
details https://laravel.com/api/5.6/Illuminate/Database/Query/Builder.html#method_whereJsonContains