I'm into routing now via use of resource routing
here is my code in router,
Route::resource('item-sales', 'ItemSalesController');
Here is my code in my controller
return View::make('item-sales.create')
When I return the view it does not make the URL I need it shows,
URL - item-sales/
What I need/Expected output of URL is,
URL - item-sales/create
Here's my controller
public function store()
{
$id = Input::get('item_id');
$new_item = Item::find($id);
$new_qty = Input::get('item_quantity');
$total = $new_item->item_price * $new_qty;
Session::put('added-items', [
0 => [
'item_id' => $id,
'item_name' => $new_item->item_name,
'item_price' => $new_item->item_price,
'item_category' => $new_item->category,
'item_quantity' => Input::get('item_quantity')
]
]);
$array = Session::get('added-items');
$total = number_format($total, 2, '.', ',');
return View::make('item-sales.create')
->with('items',$array)
->with('total',$total);
}
return View::make('item-sales.create')is written in theindexmethod of your controller. The URL will be/item-sales. check this laravel.com/docs/controllers#resource-controllers