コード例 #1
0
ファイル: routes.php プロジェクト: jeffblack360/FindMyCat
    return View::make('home');
});
Route::get('rjb/{age}', ['middleware' => 'App\\Http\\Middleware\\OldMiddleware', function ($age) {
    return "rjb -> " . $age;
}]);
Route::get('jeff', 'WelcomeController@sendJson');
Route::get('about', function () {
    return View::make('about')->with(['number_of_cats' => 999]);
});
Route::get('cats', function () {
    $cats = Cat::all();
    return View::make('cats.index', compact('cats'));
    //        ->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/{id}', function($id) {
//    $cat = Cat::find($id);
//
//    return View::make('cats.single')
//        ->with('cat', $cat);
//});
//
// The following route: cats/{cat} leverages the use of model binding to
// replace the about route definition: cats/{id}
Route::get('cats/{cat}', function (Cat $cat) {
    //    $cat = Cat::find($id);
    return View::make('cats.single')->with('cat', $cat);
});