1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 19:33:07 +01:00
freescout/app/User.php

90 lines
1.8 KiB
PHP
Raw Normal View History

2018-06-22 19:44:21 +02:00
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
2018-06-26 11:43:11 +02:00
// const CREATED_AT = 'created_at';
// const UPDATED_AT = 'modified_at';
2018-06-22 19:44:21 +02:00
/**
* Roles
*/
const ROLE_ADMIN = 'admin';
const ROLE_USER = 'user';
/**
* Invite states
*/
const INVITE_STATE_ACTIVATED = 0;
const INVITE_STATE_NOT_INVITED = 1;
const INVITE_STATE_SENT = 2;
/**
* Time formats
*/
const TIME_FORMAT_12 = 1;
const TIME_FORMAT_24 = 2;
/**
* Allowed roles
*/
public static $roles = array(self::ROLE_ADMIN, self::ROLE_USER);
/**
2018-06-26 11:43:11 +02:00
* The attributes that are not mass assignable.
2018-06-22 19:44:21 +02:00
*
* @var array
*/
protected $guarded = ['role'];
/**
2018-06-26 11:43:11 +02:00
* The attributes that should be hidden for arrays, excluded from the model's JSON form.
2018-06-22 19:44:21 +02:00
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
2018-06-24 11:01:26 +02:00
/**
* Attributes fillable using fill() method
* @var [type]
*/
protected $fillable = ['role', 'first_name', 'last_name', 'email', 'password', 'role', 'timezone', 'photo_url', 'type', 'emails', 'job_title', 'phone', 'time_format', 'enable_kb_shortcuts'];
2018-06-22 19:44:21 +02:00
/**
* Get user role
*
* @return string
*/
public function getRole()
{
return ucfirst($this->role);
}
/**
* Check if user is admin
*
* @return boolean
*/
public function isAdmin()
{
return ($this->role == self::ROLE_ADMIN);
}
2018-06-24 11:01:26 +02:00
/**
* Get user full name
* @return string
*/
public function getFullName()
{
return $this->first_name . ' ' . $this->last_name;
}
2018-06-22 19:44:21 +02:00
}