示例#1
1
 /**
  * Get or create the role.
  *
  * @return \Silber\Bouncer\Database\Role
  */
 protected function role()
 {
     if ($this->role instanceof Role) {
         return $this->role;
     }
     return Role::firstOrCreate(['name' => $this->role]);
 }
示例#2
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 Role::firstOrCreate(['name' => $this->model]);
 }