ldc-crm/app/Http/Controllers/StatsController.php

21 lines
567 B
PHP
Raw Normal View History

2021-11-03 11:18:19 +01:00
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StatsByBrandRequest;
use App\Models\BrandStat;
class StatsController extends Controller
{
public function viewStatsByBrand(StatsByBrandRequest $request)
{
$stats = null;
if ($request->post()) {
$stats = BrandStat::whereDate('created_at', '>=', $request->start)
->whereDate('created_at', '<=', $request->end)
->whereBrandId($request->brand)->get();
}
return view('stats.view-stats-by-brands', \compact('stats'));
}
}