Problem :
I want only that records where relational records [ user ] not null.
In my case i want only first record. where user is not null
Result : http://ift.tt/2hGq5mJ
User Table
- id
- name
Project Tabel
- id
- title
-
user_id
[foreign key]
My code like this$projects = App\Project::with(['user' => function ($user) { $user->where('name', '=', 'Ketan'); }]) ->get(); foreach ($projects as $project) { echo $project->title.' - '.$project; }My result like this : http://ift.tt/2hGq5mJ
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire