*/ public function rules(): array { $creating = ! $this->route('testimonial') instanceof Testimonial; $sometimes = $creating ? 'required' : 'sometimes'; return [ 'quote' => [$sometimes, new Translatable(max: 1000)], 'original_locale' => [$sometimes, 'string', Rule::in(array_keys((array) config('locales.supported')))], 'author_name' => [$sometimes, 'string', 'max:255'], 'author_role' => ['sometimes', 'nullable', new Translatable(max: 255)], 'avatar' => ['sometimes', 'nullable', 'string', 'max:2048'], 'client_id' => ['sometimes', 'nullable', 'integer', Rule::exists('clients', 'id')->whereNull('deleted_at')], 'project_id' => ['sometimes', 'nullable', 'integer', Rule::exists('projects', 'id')->whereNull('deleted_at')], 'service_id' => ['sometimes', 'nullable', 'integer', Rule::exists('services', 'id')->whereNull('deleted_at')], 'is_public' => ['sometimes', 'boolean'], 'position' => ['sometimes', 'integer', 'min:0'], 'given_at' => ['sometimes', 'nullable', 'date'], ]; } }