*/ public function rules(): array { return [ 'category_id' => ['nullable', 'exists:categories,id'], 'title' => ['required', 'string', 'max:255'], 'slug' => ['nullable', 'string', 'max:255', Rule::unique('posts', 'slug')], 'excerpt' => ['nullable', 'string', 'max:255'], 'body' => ['required', 'string'], 'featured_image' => ['nullable', 'string'], 'status' => ['required', new Enum(PostStatus::class)], 'published_at' => ['nullable', 'date'], 'meta_title' => ['nullable', 'string', 'max:60'], 'meta_description' => ['nullable', 'string', 'max:160'], 'tags' => ['sometimes', 'array'], 'tags.*' => ['integer', 'exists:tags,id'], ]; } }