<?php

namespace Portal\Mileage\Http\Controllers;

use Illuminate\Routing\Controller;
use Portal\Mileage\Model\Users;

class DashboardController extends Controller
{
	public function __construct()
	{

	}


    public function index()
    {
        // logic filter role kat user yang nak login

        if (auth()->user()->hasRole(['Administrator'])){
            // allow access to dashboard
            
        }

        $staff = Users::where('employeeCode', auth()->user()->employeeCode)
                        ->with('staffinfo.department', 'roles') // added nested relationship
                        ->first();

        return view('mileage::dashboard.pegawai',compact('staff'));
    }
}
