*/ public function rules(): array { $artist = $this->route('artist'); $organisationId = $artist instanceof Artist ? $artist->organisation_id : ($this->route('organisation')?->id ?? null); return [ 'name' => ['sometimes', 'required', 'string', 'max:120'], 'default_genre_id' => [ 'sometimes', 'nullable', 'string', 'max:30', Rule::exists('genres', 'id')->where('organisation_id', $organisationId), ], 'default_draw' => ['sometimes', 'nullable', 'integer', 'min:0'], 'star_rating' => ['sometimes', 'nullable', 'integer', 'between:1,5'], 'home_base_country' => ['sometimes', 'nullable', 'string', 'size:2', 'alpha'], 'agent_company_id' => [ 'sometimes', 'nullable', 'string', 'max:30', Rule::exists('companies', 'id')->where('organisation_id', $organisationId), ], 'notes' => ['sometimes', 'nullable', 'string', 'max:2000'], ]; } }