Models can now call $this->friendshipsReceived() to get a query with friendships that were requested by others.
For example this allows to exclude all users that are either blocked by or have blocked our authenticated user from the query:
App\User::whereDoesntHave('friendshipsReceived', function ($query) {
$query->where('status', 3);
})->whereDoesntHave('friends', function ($query) {
$query->where('status', 3);
});
Models can now call $this->friendshipsReceived() to get a query with friendships that were requested by others. For example this allows to exclude all users that are either blocked by or have blocked our authenticated user from the query: App\User::whereDoesntHave('friendshipsReceived', function ($query) { $query->where('status', 3); })->whereDoesntHave('friends', function ($query) { $query->where('status', 3); });