public function store(MotherboardRequest $request) { $motherboards = new Motherboard($request->all()); $motherboards->save(); Flash::info('Your motherboard has been added'); return redirect('motherboards'); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { // parent::boot($router); /*Route::model*/ /** * Route model binding altering default logic * $router->bind('articles',function($id){ * return \App\Article::published()->findOrFail($id); * }); */ /*Using wildcard*/ /*$router->model('articles','App\Article');*/ $router->bind('articles', function ($id) { return \App\Article::published()->findOrFail($id); }); $router->bind('rates', function ($id) { return \App\Rate::where('id', $id)->firstOrFail(); }); $router->bind('customers', function ($id) { return \App\Customer::where('id', $id)->firstOrFail(); }); $router->bind('tags', function ($name) { return \App\Tag::where('name', $name)->firstOrFail(); }); $router->bind('motherboards', function ($name) { return \App\Motherboard::where('name', $name)->firstOrFail(); }); }