CasperSecurity
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index()
{
if (Auth::user()->hasRole('superadmin')) {
return view('hr_dashboard');
} else {
return view('emp_dashboard');
}
}
public function indexhr()
{
if (Auth::user()->hasRole('superadmin') || Auth::user()->hasRole('admin')) {
return view('hr_dashboard');
}
}
public function dashboard()
{
$notifications = Auth::user()->unreadNotifications; // Fetch unread notifications
return view('dashboard', compact('notifications')); // Pass to the dashboard view
}
}