40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Backend\PageBuilder;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class EditRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool {
|
|
if (Auth::check())
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array {
|
|
if ($this->isMethod('get'))
|
|
return [];
|
|
|
|
return [
|
|
'title' => ['required', 'string', 'max:255'],
|
|
'content' => ['required', 'json'],
|
|
'publish' => ['required', 'boolean'],
|
|
'mainpage' => ['required', 'boolean'],
|
|
'linked' => ['required', 'boolean'],
|
|
'linkorder' => ['required', 'between:0,20'],
|
|
'visibility' => ['required', 'in:public,private'],
|
|
];
|
|
}
|
|
}
|