return View::make('about')->with('number_of_cats', 9000); }); Route::get('cats', function () { $cats = Cat::all(); return View::make('cats/index')->with('cats', $cats); }); Route::get('cats/breeds/{name}', function ($name) { $breed = Breed::whereName($name)->with('cats')->first(); return View::make('cats/index')->with('breed', $breed)->with('cats', $breed->cats); }); Route::get('cats/create', function () { $cat = new Cat(); return View::make('cats.edit')->with('cat', $cat)->with('method', 'post'); }); Route::post('cats', function () { $cat = Cat::create(Input::all()); return Redirect::to('cats/' . $cat->id)->with('message', 'Profil został utworzony!'); }); Route::get('cats/{id}', function ($id) { $cat = Cat::find($id); return View::make('cats.single')->with('cat', $cat); }); Route::get('cats/{cat}/edit', function (Cat $cat) { return View::make('cats.edit')->with('cat', $cat)->with('method', 'put'); }); Route::get('cats/{cat}/delete', function (Cat $cat) { return View::make('cats.edit')->with('cat', $cat)->with('method', 'delete'); }); Route::put('cats/{cat}', function (Cat $cat) { $cat->update(Input::all()); return Redirect::to('cats/' . $cat->id)->with('message', 'Profil został uaktualniony!');