ldc-legaulois/app/Http/Requests/UpdateMiniAcfRequest.php

39 lines
969 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Requests;
2021-10-04 20:08:49 +02:00
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
class UpdateMiniAcfRequest extends StoreMiniAcfRequest
{
protected $isStore = false;
2021-10-04 20:08:49 +02:00
/**
* The model var name
* used as route parameter name
*
* This is used to populate generatedRules
*
* @var array
*/
protected $modelVarName;
2021-10-04 20:08:49 +02:00
/**
* Overload createDefaultValidator
* to generate rules and merge data
* like booleans before validator is created
* as it copies data from the request.
*
* The reason : using $this->merge in rules method
* will not be taken into account
*
* @param ValidationFactory $factory
* @return void
*/
protected function createDefaultValidator(ValidationFactory $factory)
{
$this->generatedRules = $this->genRules($this->{$this->modelVarName}->content);
2021-10-04 20:08:49 +02:00
return parent::createDefaultValidator($factory);
}
}