/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Request $request, $id) { // find a single resource by ID $song = Song::find($id); if ($song) { // get the Pagination if ($request->has('currentPage')) { $currentPage = $request->currentPage; } elseif (strpos($request->server('HTTP_REFERER'), '=') !== FALSE) { $currentPage = explode('=', $request->server('HTTP_REFERER'))[1]; if (!is_numeric($currentPage)) { $currentPage = 0; } } else { $currentPage = 0; } // get list of license types first $l = new Song(); $licensesEnum = $l->getLicenseEnum(); return view($this->view_one, array('song' => $song, 'licensesEnum' => $licensesEnum, 'currentPage' => $currentPage, 'plansUsingThisSong' => $song->allPlansUsingThisSong())); } // flash('Error! Song with id "' . $id . '" not found'); return \Redirect::route($this->view_idx); }