0.1: replace Request with FormRequest in all controllers

This commit is contained in:
parsa aghaei committed 2026-06-23 18:04:57 +03:30
1 parent ffafcf447b
commit f3568ab277
15 files changed
+277 -107

No files matched your search

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Blog;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePostRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'title' => 'sometimes|required|string|max:255',
'body' => 'sometimes|required|string',
'excerpt' => 'nullable|string|max:500',
'slug' => 'sometimes|required|string|unique:posts,slug,' . $this->route('post'),
'author_id' => 'sometimes|required|exists:users,id',
'category_id' => 'sometimes|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',
];
}
}