How i can use where clause in many to many relation ship
Table: Users
id - name - email
Table: Shiftings
id - name
Table: shifting_user
id - user_id - shifting_id
User Model:
public function shiftings()
{
return $this->belongsToMany('App\shifting');
}
in controller im using below custom query
public function index()
{
return $user = DB::select('select * from shifting_user
where user_id in (select id from users)' );
}
how i can convert this to laravel standard/equloent query.