Example #1
0
<?php

use App\Models\Inventory;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', ['as' => 'home', function () {
    $items = Inventory::all()->take(4);
    return view('welcome', ['items' => $items]);
}]);
Route::group(['prefix' => 'cart'], function () {
    Route::get('/', ['uses' => 'CartController@index', 'as' => 'cart.index']);
    Route::get('add/{product_id}', ['uses' => 'CartController@add', 'as' => 'cart.add']);
    Route::get('update/{product_id}/{quantity}', ['uses' => 'CartController@update', 'as' => 'cart.update']);
    Route::get('remove/{product_id}', ['uses' => 'CartController@remove', 'as' => 'cart.remove']);
    Route::get('clear', ['uses' => 'CartController@clear', 'as' => 'cart.clear']);
});
Route::group(['prefix' => 'checkout'], function () {
    Route::match(['get', 'post'], '/', ['uses' => 'CheckoutController@index', 'as' => 'checkout.index']);
    // Route::match(['get', 'post'],'shipping', ['uses' => 'CheckoutController@shipping', 'as' => 'checkout.shipping']);
    // Route::match(['get', 'post'],'payment', ['uses' => 'CheckoutController@payment', 'as' => 'checkout.payment']);
    Route::match(['get', 'post'], 'order', ['uses' => 'CheckoutController@order', 'as' => 'checkout.order']);
});
// Coupon group routes
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $items = Inventory::all();
     return view('backoffice.inventory.index', ['items' => $items]);
 }