33 lines
762 B
PHP
33 lines
762 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Integration\Zapier;
|
||
|
|
|
||
|
|
use App\Models\Forms\Form;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class PollSubmissionRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'form_id' => [
|
||
|
|
'required',
|
||
|
|
Rule::exists(Form::getModel()->getTable(), 'slug'),
|
||
|
|
],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function form(): Form
|
||
|
|
{
|
||
|
|
return Form::query()
|
||
|
|
->where('slug', $this->input('form_id'))
|
||
|
|
->firstOrFail();
|
||
|
|
}
|
||
|
|
}
|