['required'] ]; public function index() { $seasons = Season::orderBy('name')->get(); //->paginate(50); return view('seasons.index',compact('seasons')) ->with('i', (request()->input('page', 1) - 1) * 5); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('seasons.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate($this->rules); $input = $request->all(); $input["default"] = isset($input["default"]) ? ($input["default"] == 'on' ? true : false) : false; Season::create($input); return redirect()->route('seasons.index') ->with('success','Season created successfully.'); } /** * Display the specified resource. * * @param \App\Season $season * @return \Illuminate\Http\Response */ public function show(Season $season) { return view('seasons.show',compact('season')); } /** * Show the form for editing the specified resource. * * @param \App\Season $season * @return \Illuminate\Http\Response */ public function edit(Season $season) { return view('seasons.edit',compact('season')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Season $season * @return \Illuminate\Http\Response */ public function update(Request $request, Season $season) { $request->validate($this->rules); $input = $request->all(); $input["default"] = isset($input["default"]) ? ($input["default"] == 'on' ? true : false) : false; $season->update($input); return redirect()->route('seasons.index') ->with('success','Season updated successfully'); } /** * Remove the specified resource from storage. * * @param \App\Season $season * @return \Illuminate\Http\Response */ public function destroy(Season $season) { $season->delete(); return redirect()->route('seasons.index') ->with('success','Season deleted successfully'); } }