fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $MODEL$::create($data); return Redirect::action('$NAME$@getIndex'); } /** * Display the specified $RESOURCE$. * * @param int $id * @return Response */ public function getShow($id) { $$RESOURCE$ = $MODEL$::findOrFail($id); return View::make('$COLLECTION$.show', compact('$RESOURCE$')); } /** * Show the form for editing the specified $RESOURCE$. * * @param int $id * @return Response */ public function getEdit($id) { $$RESOURCE$ = $MODEL$::find($id); return View::make('$COLLECTION$.edit', compact('$RESOURCE$')); } /** * Update the specified $RESOURCE$ in storage. * * @param int $id * @return Response */ public function postUpdate($id) { $$RESOURCE$ = $MODEL$::findOrFail($id); $validator = Validator::make($data = Input::all(), $MODEL$::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $$RESOURCE$->update($data); return Redirect::action('$NAME$@getIndex'); } /** * Remove the specified $RESOURCE$ from storage. * * @param int $id * @return Response */ public function getDestroy($id) { $MODEL$::destroy($id); return Redirect::action('$NAME$@getIndex'); } }