first commit
This commit is contained in:
51
app/Core/Validator/Property/PropertyBrandAddValidator.php
Normal file
51
app/Core/Validator/Property/PropertyBrandAddValidator.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyBrandAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'title' => 'nullable|json',
|
||||
'color_codes' => 'nullable|json',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
48
app/Core/Validator/Property/PropertyBrandPhotoValidator.php
Normal file
48
app/Core/Validator/Property/PropertyBrandPhotoValidator.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyBrandPhotoValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'photo' => 'nullable|mimes:jpg,jpeg,png,webp,gif|max:10240',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
50
app/Core/Validator/Property/PropertyCreateValidator.php
Normal file
50
app/Core/Validator/Property/PropertyCreateValidator.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use App\Core\Repository\Property\PropertyRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyCreateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyRepository $propertyRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyRepository = $propertyRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'required|min:3'
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyLocationUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'address' => 'nullable|string|max:200',
|
||||
'latitude' => 'nullable',
|
||||
'longitude' => 'nullable',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
48
app/Core/Validator/Property/PropertyPhotoValidator.php
Normal file
48
app/Core/Validator/Property/PropertyPhotoValidator.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyPhotoValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'photo' => 'nullable|mimes:jpg,jpeg,png,webp|max:10240',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
50
app/Core/Validator/Property/PropertySearchValidator.php
Normal file
50
app/Core/Validator/Property/PropertySearchValidator.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use App\Core\Repository\Property\PropertyRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertySearchValidator extends BaseValidator
|
||||
{
|
||||
private $PropertyRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyRepository $PropertyRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->PropertyRepository = $PropertyRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'required|min:3'
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
73
app/Core/Validator/Property/PropertyUpdateValidator.php
Normal file
73
app/Core/Validator/Property/PropertyUpdateValidator.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Property;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PropertyUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
$return =
|
||||
[
|
||||
'property_info.name' => 'required|min:3|max:255',
|
||||
'property_info.property_type_id' => 'required|numeric',
|
||||
'property_info.chain_id' => 'required|numeric',
|
||||
'property_info.official_name' => 'nullable|min:3|max:255',
|
||||
'property_info.country' => 'required|max:5',
|
||||
'property_info.tax_office' => 'nullable|min:3|max:255',
|
||||
'property_info.tax_number' => 'nullable|min:2|max:255',
|
||||
'property_info.checkin_time' => 'nullable|min:3|max:100',
|
||||
'property_info.checkout_time' => 'nullable|min:2|max:100',
|
||||
'additional_info' => 'array',
|
||||
'additional_info.*.year_construction' => 'nullable|string|max:100',
|
||||
'additional_info.*.year_renovation' => 'nullable|string|max:100',
|
||||
|
||||
];
|
||||
if (isset($params['additional_info']['locale_name_language']) || isset($params['additional_info']['locale_name'])) {
|
||||
if ( !empty($params['additional_info']['locale_name_language']) || !empty($params['additional_info']['locale_name'])) {
|
||||
$return['additional_info.locale_name_language'] = 'required|min:2|max:100';
|
||||
$return['additional_info.locale_name'] = 'required';
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
|
||||
// use example 'validation.input' => __('validation_type', ['input' => __('input form language key')]),
|
||||
// validation types in baseValidator switch-case block
|
||||
|
||||
$thisMessages = [
|
||||
'property_info.name.required' => __('error-input-required', ['input' => __('input-property_name')]),
|
||||
'property_info.name.min' => __('error-input-min', ['input' => __('input-property_name')]),
|
||||
|
||||
];
|
||||
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