parsaaghayi-backend/app/Http/Requests/Blog/StorePostRequest.php

32 lines
863 B
PHP

<?php
namespace App\Http\Requests\Blog;
use Illuminate\Foundation\Http\FormRequest;
class StorePostRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'title' => 'required|string|max:255',
'body' => 'required|string',
'excerpt' => 'nullable|string|max:500',
'slug' => 'required|string|unique:posts,slug',
'author_id' => 'required|exists:users,id',
'category_id' => 'required|exists:categories,id',
'featured_image' => 'nullable|url',
'views' => 'nullable|integer',
'likes' => 'nullable|integer',
'published_at' => 'nullable|date',
'tags' => 'nullable|array',
'tags.*' => 'exists:tags,id',
];
}
}