38 lines
969 B
PHP
38 lines
969 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
|
|
|
|
class UpdateMiniAcfRequest extends StoreMiniAcfRequest
|
|
{
|
|
protected $isStore = false;
|
|
|
|
/**
|
|
* The model var name
|
|
* used as route parameter name
|
|
*
|
|
* This is used to populate generatedRules
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $modelVarName;
|
|
|
|
/**
|
|
* 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);
|
|
return parent::createDefaultValidator($factory);
|
|
}
|
|
}
|