public function set($plantID, $seasonArray) { $seasons = Seasons::all(); $seasonArray = $this->filterArray($seasonArray); $cleanSeasons = $this->cleanModelArray($seasons); foreach ($seasonArray as $season) { if (is_numeric(array_search($season, $cleanSeasons))) { $newSeason = new PlantSeason(); $newSeason->plant_id = $plantID; $newSeason->season_id = array_search($season, $cleanSeasons) + 1; $newSeason->save(); } } }
/** * Show the form for editing the specified resource. * GET /team/{id}/edit * * @param int $id * @return Response */ public function edit($id) { $user = Auth::user(); $club = $user->Clubs()->FirstOrFail(); $plan = $club->plans()->lists('name', 'id'); $seasons = Seasons::all()->lists('name', 'id'); $title = 'League Together - ' . $club->name . ' Teams'; $team = Team::find($id); return View::make('app.club.team.edit')->with('page_title', $title)->with('club', $club)->with('seasons', $seasons)->with('plan', $plan)->with('team', $team)->withUser($user); }