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