first commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomRateMappingSetup;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomRateMappingSetupAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->setupType = array('EXT_ADULT', 'EXT_CHILD', 'DIS_GUEST');
|
||||
$this->valueType = array('PER', 'FIX');
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'room_rate_mapping_id' => 'required|numeric',
|
||||
'setup' => 'required|array',
|
||||
'setup.*.setup_type' => 'required|in:'.implode(',', $this->setupType),
|
||||
'setup.*.value_type' => 'required|in:'.implode(',', $this->valueType),
|
||||
'setup.*.value' => 'required|numeric',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user