If we have something like this:
user
- id
- name
role
- id
- name
shop
- id
- name
role_user
- role_id
- user_id
shop_user
- shop_id
- user_id
Quick: shop---shop_user---user---role_user---role
and we want all USER from SHOP 1 with ROLE admin. How can we do that?
all USER from SHOP 1:
$shop = Shop::find( $shopId );
$shop->users()->get();
Something like this would be nice:
$shop = Shop::find( $shopId );
$shop->users()->roles->()->where( 'name', 'Admin' )->get();