Example of Collection Methods: Unique in agorakit/agorakit

File app/Http/Controllers/Admin/GroupAdminsController.php (link to Github)
use App\Http\Controllers\Controller;
use App\Membership;

class GroupAdminsController extends Controller
{
    public function index()
    {
        $memberships = Membership::where('membership', Membership::ADMIN)
        ->with('user')
        ->get();

        $users = collect();

        foreach ($memberships as $membership) {
            $users->push($membership->user);
        }

        $users = $users->unique('username');

        return view('admin.groupadmins.index')->with('users', $users);
    }
}