'datetime', ]; /** * @param string|array $roles */ public function authorizeRoles($roles){ if (is_array($roles)) { return in_array($this->role, $roles) || abort(401, 'Cette action n\'est pas autorisée.'); } return $this->role == $roles || abort(401, 'Cette action n\'est pas autorisée.'); } /** * Check one role * @param string $role */ public function hasRole($roles) { if (is_array($roles)) { return in_array($this->role, $roles); } return $this->role == $roles; } /** * get one role label * @param string $role */ public function getRoleLabel() { return config('roles.label.'.$this->role); } /** * The marques that belong to the user. */ public function marques() { return $this->belongsToMany('App\Marque', 'marques_users', 'user_id', 'marque_id'); } /** * The dossiers that belong to the user. */ public function dossiers() { return $this->belongsToMany('App\Dossier', 'dossiers_users', 'user_id', 'dossier_id'); } /** * The sujet that belong to the user. */ public function sujets() { return $this->belongsToMany('App\Sujet', 'sujets_users', 'user_id', 'sujet_id'); } }