Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
DashboardController
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 __invoke
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Controllers\Admin;
4
5use App\Http\Controllers\Concerns\ResolvesContext;
6use App\Http\Controllers\Controller;
7use App\Models\Order;
8use App\Services\DashboardMetricsService;
9use Illuminate\View\View;
10
11class DashboardController extends Controller
12{
13    use ResolvesContext;
14
15    public function __invoke(DashboardMetricsService $metrics): View
16    {
17        $store = $this->currentStore();
18
19        return view('admin.dashboard', [
20            'store' => $store,
21            'metrics' => $metrics->admin($store),
22            'latestOrders' => Order::query()->with('influencer', 'commission')->where('store_id', $store->id)->latest()->limit(8)->get(),
23        ]);
24    }
25}