hootlex / laravel-friendships

This package gives Eloquent models the ability to manage their friendships.
MIT License
705 stars 150 forks source link

Allow models to get friendships requested by others #90

Closed jacobg213 closed 2 years ago

jacobg213 commented 7 years ago

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); });