Files
2025-08-17 16:23:14 +05:45

60 lines
1.7 KiB
PHP

<?php
namespace Modules\Post\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PostRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'slug' => 'nullable|string',
'image' => 'nullable|image|mimes:jpeg,png,jpg,gif',
'title' => 'nullable|string|max:255',
'short_detail' => 'nullable|string',
'full_detail' => 'nullable|string',
'page_id' => 'nullable|integer',
'order' => 'nullable|integer',
'sidebar_flag' => 'nullable|integer',
'navbar_flag' => 'nullable|integer',
'meta_title' => 'nullable',
'meta_description' => 'nullable',
'meta_keywords' => 'nullable'
];
}
public function messages()
{
return [
'slug.string' => 'The slug field must be a string.',
'image.image' => 'The image must be an image file.',
'image.mimes' => 'The image must be a file of type: jpeg, png, jpg, gif.',
'title.string' => 'The title field must be a string.',
'title.max' => 'The title may not be greater than 255 characters.',
'short_detail.string' => 'The short detail field must be a string.',
'full_detail.string' => 'The full detail field must be a string.',
'page_id.integer' => 'The page ID field must be an integer.',
'order.integer' => 'The order field must be an integer.',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}