git add .
git commit "feat: add last 10 days visits chart to dashboard"
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Admin;
|
||||
use App\Models\Flight;
|
||||
use App\Models\Tour;
|
||||
@@ -21,15 +22,20 @@ class DashboardController extends Controller
|
||||
$flightsCount = Flight::count();
|
||||
|
||||
$tourViews= Tour::query()
|
||||
->selectRaw('DATE(create_at) as date,SUM(views) as total')
|
||||
->selectRaw('DATE(created_at) as date,SUM(views) as total')
|
||||
->where('created_at','>=',now()->subDays(9))
|
||||
->qroupBy('date')
|
||||
->groupBy('date')
|
||||
->orderBy('date')
|
||||
->get();
|
||||
|
||||
$logs = ActivityLog::with('admin')
|
||||
->latest()
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
return view('admin.dashboard',compact('adminsCount',
|
||||
'usersCount','toursCount','flightsCount','tourViews'
|
||||
,'logs'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user