I am using Laravel 7 to build Restaurant system and I maked form that go to specific route and I get name route but it is display error as the title
this manager view
<form method="post" action="" >
@csrf
<div class="form-group">
<select class="form-control" name="dish">
@for($i = 0 ; $i < count($InetialData['dish']) ; $i++))
<option value=""> </option>
@endfor
</select>
</div>
and this my web Route file
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/manager','ManagerController@dashboard');
Route::post('/manager','ManagerController@addItem');
Route::get('/manager/{id}','ManagerController@deleteTable')->name('admin.deleteTable');
Route::post('/manager','ManagerController@destroyDish')->name('admin.distroyDish');
Route::post('/manager' ,'ManagerController@addIngrediant')->name('admin.addIngrediant');
Route::get('/kitchen' , 'KitchenController@index')->name('kitchen.home');
Route::get('/kitchen/{id}' ,'KitchenController@submitDish')->name('kitchen.submit.dish');
Route::post('/kitchen','KitchenController@addIngrediant')->name('kitchen.addIngrediant');
and this ManagerController
private function initData(){
$InetialData = array(
'category'=> DB::table('Category')->get(),
'dish' => DB::table('Items')->get(),
'users' => DB::table('users')->get(),
'Ingrediant' => DB::table('Ingrediant')->get(),
'IngrediantHistory' => DB::table('IngrediantHistory')->get()
);
return $InetialData;
}
public function destroyDish(Request $request){
DB::table('Items')->where('id', '=',$request->dish)->delete();
return redirect('/manager')->with('InetialData' , $this->initData());
}
other route like kitchen is work why this route is not work ??
Aucun commentaire:
Enregistrer un commentaire