/** * Show a list of all available flights. * * @return Response */ public function index() { $products = Products::all(); echo 'in product_controller'; return view('products.index', ['products' => $products]); }
public function getProducts() { if (!empty(session('currencyId'))) { $currency = session('currencyId'); } elseif (isset($_POST['currencyId'])) { \Session::put('currencyId', $_POST['currencyId']); $currency = session('currencyId'); } else { \Session::put('currencyId', '0'); $currency = session('currencyId'); } $products = Products::all()->toArray(); $currencies = \DB::table('currency')->get(); $data[] = ['products' => $products, 'currencies' => $currencies, 'defaultCurrency' => $currency]; return json_encode($data); }