<?php

namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;

class Home extends BaseController
{
    use ResponseTrait;

    private $user;

    public function index()
    {
        $this->user = service("user_data"); 
        if($this->user->data->level == 'admin'){
            return redirect()->to('admin/home');
        }if($this->user->data->level == 'operator'){
            return redirect()->to('operator/home');
        }if($this->user->data->level == 'waiter'){
            return redirect()->to('waiter/home');
        }
    }
}
