*/ public function rules(): array { $organisationId = $this->route('organisation') instanceof Organisation ? $this->route('organisation')->id : (string) $this->route('organisation'); return [ 'name' => [ 'required', 'string', 'max:40', Rule::unique('genres', 'name')->where('organisation_id', $organisationId), ], 'color' => ['nullable', 'string', 'size:7', 'regex:/^#[0-9A-Fa-f]{6}$/'], 'sort_order' => ['nullable', 'integer', 'min:0'], 'is_active' => ['nullable', 'boolean'], ]; } }