please make a search this inventory.order in your text editor you have defined it somewhere. and try to hard refresh the browser (ctrl+f5)
Jun 15, 2018
16
Level 1
Route [inventory.orderShirt] not defined.
I am making a page where there are 3 tables. Inventory, Rate, and Order. Inventory and Rate alone is working. but adding the order gives me that error.
shows.blade
//rating
{!! Form::open(array('route' => array('inventory.showRate', $inventories->id), 'method'=>'POST')) !!}
{{Form::label('rating','Rating')}}
{{Form::select('rating', ['1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5'], '3', ['placeholder' => 'Select rating'])}}
{{Form::submit('Submit', ['class'=>'btn btn-primary'])}}
//inventory
ID
{$inventories->id}}
Name
{{$inventories->name}}
//order
{!! Form::open(array('route' => array('inventory.orderShirt', $inventories->id), 'method'=>'POST')) !!}
{{Form::submit('Submit', ['class'=>'btn btn-primary'])}}
{!! Form::close()!!}
controller.php
public function shows($id)
{
$inventories = Inventory::find($id);
return view('inventory.show')->with('inventories', $inventories);
}
public function showRate(Request $request, $id)
{
$inventories = Inventory::find($id);
//create rating
$ratings = new Rating;
$ratings->rating = $request->input('rating');
$ratings->inv_id = $inventories->id;
$ratings->user_id = auth()->user()->id;
$ratings->save();
return redirect('/store')->with('success','Rating updated');
}
public function orderShirt(Request $request, $id)
{
$inventories = Inventory::find($id);
//create order
$orders = new Order;
$orders->order_id = Str::random(20);
$orders->inv_order_id = $inventories->id;
$orders->user_order_id = auth()->user()->id;
$orders->save();
return redirect('/store')->with('success','Order complete!');
// ->with('success','order added');
}
web.php
Route::post('/store/{id}','InventoryController@orderShirt')->name('inventory.orderShirt');
Route::post('/store/{id}','InventoryController@showRate')->name('inventory.showRate');
Route::get('store/{id}', 'InventoryController@shows')->name('inventory.shows');
I hope you could help me! Thank you in advance :)
P.S. I am using laravel collective
Level 50
@graffislife change this route path /store/{id} it's the same for two different routes (and route action Post in both routes) that's way laravel gets 2 one
Please or to participate in this conversation.