Пример #1
0
<?php

Route::get('', ['as' => 'admin.home', function () {
    $orders = \App\Models\Order::all()->where('status', 2);
    $count = 0;
    foreach ($orders as $order) {
        $count = $count + $order->sum;
    }
    return Admin::view(view('admin.dashboard', compact(['count', 'orders'])), 'Панель администратора');
}]);
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('backoffice.order.index', ['items' => Order::all()]);
 }