public function isClubAdmin($bookClubId) { $bookclub = \App\BookClub::with('admin')->findOrFail($bookClubId); if (auth()->user()->id == $bookclub->admin->id) { return true; } return false; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $bookclubs = \App\BookClub::with('books', 'members', 'admin')->orderBy('user_id')->get(); // return response()->json($bookclubs); return view('bookclubs.index')->with('bookclubs', $bookclubs); }