| Server IP : 138.197.107.151 / Your IP : 216.73.217.7 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/silversharkadmindev/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Website;
use App\Models\User;
class DashboardController extends Controller
{
// Apply auth middleware so only logged-in users can access
public function __construct()
{
$this->middleware('auth');
}
// Show dashboard page
public function index()
{
$data = session('website_json');
if($data){
return redirect("/generate-site");
}
$from_date = date("Y-m-d H:i:s", time()-7*24*60*60);
$websites_count = Website::where("created_at",">=", $from_date)->count();
$users_count = User::where("created_at",">=", $from_date)->count();
$recent_websites = Website::where("status","completed")->orderBy("id","desc")->limit(5)->get();
$recent_users = User::orderBy("id","desc")->limit(5)->get();
$title = "Dashboard";
// You can pass data to the view if needed
return view('dashboard', compact('websites_count','users_count','recent_websites','recent_users', 'title'));
}
}