Browsed by
Snippet Tag: laravel

belongsToMany Not In

belongsToMany Not In

>>> $notIn = $allSites->diff($c->sites); => Illuminate\Database\Eloquent\Collection {#821 all: [ AppSites {#833 id: 2, site_name: "Bar", url: "http://bar", created_at: "2018-02-14 09:53:39", updated_at: "2018-02-14 09:53:39", }, ], }

table users

table users

table users id | name | email | updated_at | modified_at 1 John john@example.com 2018-01-01 01:00:00 2018-01-01 01:00:00

table users_sites

table users_sites

table users_sites id | users_id | sites_id | updated_at | modified_at 1 1 1 2018-01-01 23:20:12 2018-01-01 23:20:12