public function setIndividualPermission($permission, $value) { $object = is_string($permission) ? Permission::withName($permission) : $permission; if (!$object instanceof Permission) { throw new \InvalidArgumentException('The argument has to be the name of an existing permission or the permission object.'); } $this->individualPermissions()->save($object, ['value' => $value, 'assigned_type' => static::class]); return $this; }
public function test_it_returns_null_when_the_name_does_not_exist() { $permission = Permission::withName('Hourglass.Backend::this.is.a.very.unlikely.test'); $this->assertNull($permission); }