*/ class UserController extends Controller { /** * Create a new controller instance. * constructor to check * 1. authentication * 2. user roles * 3. roles must be agent * * @return void */ public function __construct() { $this->middleware('auth'); $this->middleware('role.agent'); // $this->middleware('roles'); } /** * Display a listing of the resource. * @param type User $user * @return type Response */ public function index() { try { /* get all values in Sys_user */ return view('themes.default1.agent.helpdesk.user.index'); } catch (Exception $e) { return view('404'); } } /** * This function is used to display the list of users * @return datatable */ public function user_list() { return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) ->searchColumns('user_name') ->orderColumns('user_name', 'email') ->addColumn('user_name', function ($model) { return $model->user_name; }) ->addColumn('email', function ($model) { $email = $model->email; return $email; }) ->addColumn('phone', function ($model) { $phone = ""; if ($model->phone_number) { $phone = $model->ext . ' ' . $model->phone_number; } $mobile = ""; if ($model->mobile) { $mobile = $model->mobile; } $phone = $phone . " " . $mobile; return $phone; }) ->addColumn('status', function ($model) { $status = $model->active; if ($status == 1) { $stat = ''; } else { $stat = ''; } return $stat; }) ->addColumn('lastlogin', function ($model) { $t = $model->updated_at; return TicketController::usertimezone($t); }) ->addColumn('Actions', function ($model) { //return 'id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete id . '/edit class="btn btn-warning btn-flat">Edit id . ' class="btn btn-warning btn-flat">View'; //return '
id . '/edit class="btn btn-warning btn-flat">Edit id . ' class="btn btn-warning btn-flat">View'; return ' ' . \Lang::get('lang.delete') . ' ' . \Lang::get('lang.edit') . ' ' . \Lang::get('lang.view') . '