53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Gallery\app\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CreateGalleryRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'detail' => 'sometimes|nullable|string',
|
|
'image' => 'sometimes|nullable|image|mimes:jpeg,png,jpg,gif',
|
|
'image_path' => 'string|sometimes',
|
|
'type' => 'string|sometimes',
|
|
'category' => 'string|sometimes|nullable',
|
|
'video_link' => 'string|sometimes|nullable',
|
|
'status' => 'required',
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
'detail.string' => 'The detail 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.',
|
|
|
|
'image_path.string' => 'The image path field must be a string.',
|
|
|
|
'type.string' => 'The type field must be a string.',
|
|
|
|
'category.string' => 'The category field must be a string.',
|
|
|
|
'video_link.string' => 'The video link field must be a string.',
|
|
|
|
'status.required' => 'The status field is required.',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|