/**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     // Assign an event
     $event = Event::assign();
     $localClubs = Helpers::getUserClubs();
     $weighInSites = Helpers::getWeighInSites();
     $fishingSectors = Helpers::getWeighInSectors();
     $fishingLocations = Helpers::getWeighInLocations();
     return view('admin.pages.weigh-ins.create', compact('event', 'localClubs', 'weighInSites', 'fishingSectors', 'fishingLocations'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $anglers = User::all();
     $localClubs = Helpers::getUserClubs();
     return view('admin.pages.anglers.index', compact('anglers', 'localClubs'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // Use eager loading to pass address relation
     $user = User::with(['address', 'categories'])->findOrFail($id);
     $userRoles = Helpers::getUserRoles();
     $userClubs = Helpers::getUserClubs();
     $userCategories = Helpers::getUserCategories();
     // Makes sure category checkboxes are correctly checked off
     // Assigns category id to collection index
     if (!$user->categories->isEmpty()) {
         foreach ($user['categories'] as $category) {
             $user['categories'][$category->id] = $category;
         }
         unset($user['categories'][0]);
     }
     return view('admin.pages.users.edit', compact('user', 'userCategories', 'userClubs', 'userRoles'));
 }