Changeset View
Changeset View
Standalone View
Standalone View
src/app/Rules/ResourceName.php
- This file was copied to src/app/Rules/SharedFolderName.php.
Show All 39 Lines | public function passes($attribute, $name): bool | ||||
} | } | ||||
// Check the max length, according to the database column length | // Check the max length, according to the database column length | ||||
if (strlen($name) > 191) { | if (strlen($name) > 191) { | ||||
$this->message = \trans('validation.max.string', ['max' => 191]); | $this->message = \trans('validation.max.string', ['max' => 191]); | ||||
return false; | return false; | ||||
} | } | ||||
// Check if specified domain is belongs to the user | // Check if specified domain belongs to the user | ||||
$domains = \collect($this->owner->domains(true, false))->pluck('namespace')->all(); | $domains = \collect($this->owner->domains(true, false))->pluck('namespace')->all(); | ||||
if (!in_array($this->domain, $domains)) { | if (!in_array($this->domain, $domains)) { | ||||
$this->message = \trans('validation.domaininvalid'); | $this->message = \trans('validation.domaininvalid'); | ||||
return false; | return false; | ||||
} | } | ||||
// Check if the name is unique in the domain | // Check if the name is unique in the domain | ||||
// FIXME: Maybe just using the whole resources table would be faster than resources()? | // FIXME: Maybe just using the whole resources table would be faster than resources()? | ||||
Show All 23 Lines |