I have users model in laravel
public static function searchScoop($keyword)
{
$users = User::where('username','like','%'.$keyword.'%')->
orwhere('email','like','%'.$keyword.'%')->
orwhere('phone','like','%'.$keyword.'%')->
with('user_permission','user_division')->
get(['id','username','email','phone','division','permission']);
return $users;
}
now how can i get trashed results with users variable i tried to to put withTrashed -> before where after get everywhere but noting works ..
thank you
Please try with withTrashed()
which will give also the soft deleted records. If you only want soft deleted records use onlyTrashed()
public static function searchScoop($keyword)
{
$users = User::withTrashed()
->where('username','like','%'.$keyword.'%')
->orwhere('email','like','%'.$keyword.'%')
->orwhere('phone','like','%'.$keyword.'%')
->with('user_permission','user_division')
->get(['id','username','email','phone','division','permission']);
return $users;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With