cms/app/Http/Requests/Admin/Forms/UpdateFormRequest.php

32 lines
754 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Admin\Forms;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFormRequest extends BaseFormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return $this->user() && $this->user()->hasPermission('edit-forms');
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
$form = $this->route('form');
$id = $form instanceof \App\Models\Form ? $form->id : $form;
return $this->baseRules($id);
}
}