33 lines
957 B
PHP
33 lines
957 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StorePressReleaseImageRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->tokenCan('press-release-images:write') === true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'image' => ['required', 'image', 'mimes:jpg,jpeg,png,webp', 'max:8192'],
|
|
'title' => ['nullable', 'string', 'max:120'],
|
|
'description' => ['nullable', 'string', 'max:500'],
|
|
'copyright' => ['nullable', 'string', 'max:255'],
|
|
'is_preview' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|