Hi guys i am using laravel5.5 I have two tables Users and Services
Users Table
- id
- name
- password
- address
- city
- country
- zipcode
Service table
- id
- User_id
- name
- description
- price
In User Model
public function services()
{
return $this->hasMany('App\Service');
}
In Service Model
public function user()
{
return $this->belongsTo('App\User');
}
Now in controller I need all services where user->zipcode = 20006 How can i get it I have tried this below code
$services = Service::with('user')->where('user->zipcode', '20006')->get();
But it did not work.
thanks in advance. Warm Regards: Abdullah Shahid.