I have following table
users
id | username | password
1 | scott | 98746
2 | mark | 6542
3 | michel | 6589
user_detail
id | user_id | status | mobile_number
1 | 1 | pending | 987643210
2 | 2 | review | 3216547901
Now i want to retrieve those record where user has no records in user_detail
table where status=pending
I have tried using relations in latest version
$user=User::with('userDetail')
->whereDoesntHave('userDetail',function ($query){
$query->where('status','pending');
})->get();
Same logic i am looking for without relations in laravel.Since we are using old laravel version which doesn't support.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire