33 lines
779 B
PHP
33 lines
779 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Admin\Pages;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class UpdatePageRequest extends BasePageRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return bool
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return $this->user()->hasPermission('update-pages');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
$page = $this->route('page');
|
||
|
|
$pageId = $page instanceof \App\Models\Page ? $page->id : $page;
|
||
|
|
|
||
|
|
return $this->baseRules($pageId);
|
||
|
|
}
|
||
|
|
}
|