first commit
This commit is contained in:
32
app/Http/Controllers/Admin/DashboardController.php
Normal file
32
app/Http/Controllers/Admin/DashboardController.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use App\Models\LeaderboardMaster;
|
||||
use Auth;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
// public function index(){
|
||||
//// $userCount = User::count();
|
||||
// return view('Admin.dashboard')->with(['user_count' => $userCount]);
|
||||
// }
|
||||
|
||||
public function view_dashboard() {
|
||||
// dd(Auth::user());
|
||||
$manage_dashboard = LeaderboardMaster::with('user')->get()->toArray();
|
||||
// echo "<pre>";
|
||||
// print_r($manage_dashboard);
|
||||
// exit();
|
||||
|
||||
// Sort the $manage_dashboard array by the 'total_score' attribute in descending order
|
||||
usort($manage_dashboard, function($a, $b) {
|
||||
return $b['total_score'] <=> $a['total_score'];
|
||||
});
|
||||
return view('Admin.dashboard')->with(['manage_dashboard' => $manage_dashboard]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user