%PDF- %PDF-
Direktori : /var/www/html/rental/app/Models/ |
Current File : /var/www/html/rental/app/Models/User.php |
<?php namespace App\Models; use Illuminate\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class User extends Model implements AuthenticatableContract, CanResetPasswordContract { use Authenticatable, CanResetPassword; public $timestamps = false; /** * The database table used by the model. * * @var string */ protected $table = 'users'; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = array('password'); public function setPasswordAttribute($pass) { $this->attributes['password'] = \Hash::make($pass); } /** * Get the unique identifier for the user. * * @return mixed */ public function getAuthIdentifier() { return $this->getKey(); } /** * Get the password for the user. * * @return string */ public function getAuthPassword() { return $this->password; } /** * Get the e-mail address where password reminders are sent. * * @return string */ public function getReminderEmail() { return $this->email; } public function checkPermissions($routeURL) { $permissions = Cache::rememberForever('role_rights/role_'.$this->id_role, function() { $indexedPermissions = array(); $roleRights = Roleright::where('id_role', '=', $this->id_role)->get(array('route_url')); foreach($roleRights as $right) { $indexedPermissions[$right->route_url] = 1; } return $indexedPermissions; }); return isset($permissions[$routeURL]); } }