/** * 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]); }
/** * 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]); }