public function updateStatus($banque_Id, $status)
 {
     $banque = Banque::find($banque_Id);
     $banque->status = $status;
     $banque->save();
     return redirect('/banque');
 }
Beispiel #2
0
 Route::match(['get', 'post'], '/{banque_id}', 'BanqueController@show')->where('banque_id', '[0-9]+');
 // edit banque
 Route::match(['get', 'post'], '/{banque_id}/edit', 'BanqueController@edit')->where('banque_id', '[0-9]+');
 // delete banque
 Route::match(['get', 'post'], '/{banque_id}/delete', 'BanqueController@delete')->where('banque_id', '[0-9]+');
 // display banque view
 Route::match(['get', 'post'], '/{banque_id}/detail', 'BanqueController@detail')->where('banque_id', '[0-9]+');
 Route::match(['get', 'post'], '/{banque_id}/{status}', 'BanqueController@updateStatus')->where('banque_id', '[0-9]+')->where('status', '[0-9]+');
 // store in the banque
 Route::post('/add', 'BanqueController@store');
 // test if the a banque with specified id not found
 Route::filter('banqueId', function (Illuminate\Routing\Route $route) {
     if (is_null($route->getParameter('banque_id'))) {
         return Redirect::to('banque');
     } else {
         if (is_null(Banque::find($route->getParameter('banque_id')))) {
             return Response::json(['error' => 'Banque not found'], HttpResponse::HTTP_NOT_FOUND);
         }
     }
 });
 // item group
 Route::group(['prefix' => '/{banque_id}/item', 'before' => 'banqueId'], function () {
     // display all banque items
     Route::match(['get', 'post'], '/', 'ItemController@show');
     // display specific banque item
     Route::match(['get', 'post'], '/{item_id}', 'ItemController@show')->where('item_id', '[0-9]+');
     // store a banque item
     Route::post('/add', 'ItemController@store');
     // Edit item
     Route::post('/{item_id}/edit', 'ItemController@edit')->where('item_id', '[0-9]+');
     // Delete item