Exemple #1
0
 /**
  * Get the model or create a role.
  *
  * @return \Illuminate\Database\Eloquent\Model
  */
 protected function getModel()
 {
     if ($this->model instanceof Model) {
         return $this->model;
     }
     return Models::role()->firstOrCreate(['name' => $this->model]);
 }
Exemple #2
0
 /**
  * Get or create the role.
  *
  * @return \JonaGoldman\Bouncer\Database\Role
  */
 protected function role()
 {
     if ($this->role instanceof Role) {
         return $this->role;
     }
     return Models::role()->firstOrCreate(['name' => $this->role]);
 }
 /**
  * Get the model from which to remove the abilities.
  *
  * @return \Illuminate\Database\Eloquent\Model|null
  */
 protected function getModel()
 {
     if ($this->model instanceof Model) {
         return $this->model;
     }
     return Models::role()->where('name', $this->model)->first();
 }
Exemple #4
0
 /**
  * Get the role.
  *
  * @return \JonaGoldman\Bouncer\Database\Role|null
  */
 protected function role()
 {
     if ($this->role instanceof Role) {
         return $this->role;
     }
     return Models::role()->where('name', $this->role)->first();
 }
Exemple #5
0
 /**
  * Get an instance of the role model.
  *
  * @param  array  $attributes
  * @return \JonaGoldman\Bouncer\Database\Role
  */
 public function role(array $attributes = [])
 {
     return Models::role($attributes);
 }
 /**
  * Get the table name for the role model.
  *
  * @return string
  */
 protected function roles()
 {
     return Models::role()->getTable();
 }