first commit
This commit is contained in:
109
app/Core/Validator/BaseValidator.php
Normal file
109
app/Core/Validator/BaseValidator.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator;
|
||||
|
||||
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Illuminate\Validation\Factory;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
|
||||
class BaseValidator extends Factory
|
||||
{
|
||||
|
||||
private $keyMapping;
|
||||
|
||||
public function __construct(Translator $translator, Container $container = null)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->keyMapping = [
|
||||
'phone' => "enw-input-mobile_phone",
|
||||
'photo' => "enw-input-photo",
|
||||
'room_rate_id' => "enw-input-rate_select",
|
||||
'room_id' => "enw-input-room",
|
||||
'description' => "enw-input-description",
|
||||
'included_occupancy' => "enw-input-included_occupancy",
|
||||
'max_room_occupancy' => "enw-input-max_room_occupancy",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$messages = [];
|
||||
$rules = $this->rules();
|
||||
foreach ($rules as $key => $rule) {
|
||||
$ruleArray = explode('|', $rule);
|
||||
$langKey = isset($this->keyMapping[$key]) ? $this->keyMapping[$key] : $key;
|
||||
foreach ($ruleArray as $ruleItem) {
|
||||
$ruleArray = explode(':', $ruleItem) ;
|
||||
$rule = $ruleArray[0] ;
|
||||
$value = isset($ruleArray[1]) ? $ruleArray[1] : null ;
|
||||
switch ($rule) {
|
||||
case 'required':
|
||||
$messages[$key . '.' . $rule] = __('error-input-required', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'required_with':
|
||||
$messages[$key . '.' . $rule] = __('error-input-required', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'required_without':
|
||||
$messages[$key . '.' . $rule] = __('error-input-required', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'numeric':
|
||||
$messages[$key . '.' . $rule] = __('error-input-numeric', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'array':
|
||||
$messages[$key . '.' . $rule] = __('error-input-array', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'date':
|
||||
$messages[$key . '.' . $rule] = __('error-input-date', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'email':
|
||||
$messages[$key . '.' . $rule] = __('error-input-email', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'integer':
|
||||
$messages[$key . '.' . $rule] = __('error-input-integer', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'max':
|
||||
$messages[$key . '.' . $rule] = __('error-input-max', ['input' => __($langKey), 'max' => $value]);
|
||||
break;
|
||||
case 'min':
|
||||
$messages[$key . '.' . $rule] = __('error-input-min', ['input' => __($langKey), 'min' => $value]);
|
||||
break;
|
||||
case 'string':
|
||||
$messages[$key . '.' . $rule] = __('error-input-string', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'boolean':
|
||||
$messages[$key . '.' . $rule] = __('error-input-boolean', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'date_format':
|
||||
$messages[$key . '.' . $rule] = __('error-input-date-format', ['input' => __($langKey), 'format' => $value] );
|
||||
break;
|
||||
case 'in':
|
||||
$messages[$key . '.' . $rule] = __('error-input-in-array', ['input' => __($langKey), 'value' => $value]);
|
||||
break;
|
||||
case 'image':
|
||||
$messages[$key . '.' . $rule] = __('error-input-image', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'mimes':
|
||||
$messages[$key . '.' . $rule] = __('error-input-mimes', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'confirmed':
|
||||
$messages[$key . '.' . $rule] = __('error-input-confirmed', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'accepted':
|
||||
$messages[$key . '.' . $rule] = __('error-input-accepted', ['input' => __($langKey)]);
|
||||
break;
|
||||
case 'present':
|
||||
$messages[$key . '.' . $rule] = __('error-input-present', ['input' => __($langKey)]);
|
||||
break;
|
||||
default :
|
||||
$messages[$key . '.' . $rule] = __('error-input-unknown-error', ['input' => __($langKey), 'rule' => $ruleItem]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
47
app/Core/Validator/Booking/BookingUpdateValidator.php
Normal file
47
app/Core/Validator/Booking/BookingUpdateValidator.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Booking;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class BookingUpdateValidator extends BaseValidator
|
||||
{
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return [
|
||||
'property_id' => 'required|numeric',
|
||||
'booking_id' => 'required|numeric',
|
||||
'total' => 'required|numeric',
|
||||
'currency_code' => 'required|min:3|max:3',
|
||||
'status' => 'required|numeric|in:0,1,2,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());
|
||||
}
|
||||
|
||||
}
|
||||
49
app/Core/Validator/BookingEngine/ContractUploadValidator.php
Normal file
49
app/Core/Validator/BookingEngine/ContractUploadValidator.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\BookingEngine;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class ContractUploadValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'contract_file' => 'nullable|mimes:pdf|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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Destination;
|
||||
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class DestinationSearchValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'search_term' => 'required|min:3',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages =
|
||||
[
|
||||
"search_term.required" => lang("search_term is required"),
|
||||
"search_term.min" => lang("search_term can be minimum 3 characters"),
|
||||
];
|
||||
|
||||
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,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\EnwContactForm;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class EnwContactFormCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"name" => 'required|max:100',
|
||||
"surname" => 'required|max:100',
|
||||
"email" => 'required|email|max:150',
|
||||
"subject" => 'required|max:500'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
66
app/Core/Validator/ExampleValidator.php
Normal file
66
app/Core/Validator/ExampleValidator.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ExampleValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container,
|
||||
Request $request
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container, $request);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'required|min:32',
|
||||
'array1' => 'required|array|in:d,e,f',
|
||||
'phone' => 'required',
|
||||
'contact.address' => 'required',
|
||||
'contact.email' => 'required|email',
|
||||
'id' => 'required|integer'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function messages()
|
||||
{
|
||||
|
||||
// use example 'validation.input' => __('validation_type', ['input' => __('input language_key')]),
|
||||
// validation types in baseValidator switch-case block
|
||||
//
|
||||
|
||||
$thisMessages = [
|
||||
'contact.email.required' => __('error-input-required', ['input' => __('myweb-contact-mail_title')]),
|
||||
'name.required' => __('error-input-required', ['input' => __('input-property_name')]),
|
||||
'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());
|
||||
}
|
||||
|
||||
}
|
||||
47
app/Core/Validator/Offer/OfferCreateValidator.php
Normal file
47
app/Core/Validator/Offer/OfferCreateValidator.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Offer;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"title" => 'required|min:3|max:200',
|
||||
"expire_date" => 'required|date',
|
||||
"language" => 'required|min:2|max:10',
|
||||
"currency" => 'required|min:3|max: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());
|
||||
}
|
||||
|
||||
}
|
||||
45
app/Core/Validator/Offer/OfferStatusValidator.php
Normal file
45
app/Core/Validator/Offer/OfferStatusValidator.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Offer;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferStatusValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"offer_id" => 'required|numeric',
|
||||
"status" => 'required|boolean'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
46
app/Core/Validator/Offer/OfferUpdateValidator.php
Normal file
46
app/Core/Validator/Offer/OfferUpdateValidator.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\Offer;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"title" => 'required|min:3|max:200',
|
||||
"expire_date" => 'required|date',
|
||||
"language" => 'required|min:2|max:10',
|
||||
"currency" => 'required|min:3|max: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,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferAccommodationMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferAccommodationMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"accommodation_mapping" => 'required|array',
|
||||
"accommodation_mapping.*" => 'required|numeric',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [
|
||||
'accommodation_mapping.required' => __('error-input-accommodation_mapping-required')
|
||||
|
||||
];
|
||||
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,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferAccommodationMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferAccommodationMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"property_accommodation_id" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferCancellationPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferCancellationPolicyCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params=null)
|
||||
{
|
||||
|
||||
$return =
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"has_cancellation_policy" => 'required|boolean',
|
||||
];
|
||||
|
||||
if(fillOnUndefined($params, 'has_cancellation_policy', false) == true)
|
||||
{
|
||||
$return['cancellation_policy'] = 'required|array|min:1';
|
||||
$return['cancellation_policy.*.days_before'] = 'required|numeric';
|
||||
$return['cancellation_policy.*.type'] = 'required|in:FIX,PER';
|
||||
$return['cancellation_policy.*.value'] = 'required|numeric';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
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,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferContactMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferContactMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"contact_mapping" => 'array',
|
||||
"contact_mapping.*" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferContactMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferContactMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"property_executive_id" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferFactMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferFactMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"fact_mapping" => 'array',
|
||||
"fact_mapping.*" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferFactMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferFactMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"category_id" => 'required|numeric',
|
||||
"property_fact_parent_id" => 'required|numeric',
|
||||
"property_fact_id" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferImportantNotes;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferImportantNotesCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"important_notes" => 'nullable|array',
|
||||
"important_notes.*" => 'nullable|string'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferPaymentType;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferPaymentTypeCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
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,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferPhotoMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferCoverPhotoAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"cover_photos" => 'array',
|
||||
"cover_photos.*" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferPhotoMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferPhotoMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"photo_mapping" => 'array',
|
||||
"photo_mapping.*" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferPhotoMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferPhotoMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"property_photo_id" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
51
app/Core/Validator/OfferPrice/OfferPriceCreateValidator.php
Normal file
51
app/Core/Validator/OfferPrice/OfferPriceCreateValidator.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferPrice;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferPriceCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"date" => 'required|date',
|
||||
"property_room_id" => 'required|numeric',
|
||||
"property_accommodation_id" => 'required|numeric',
|
||||
"number_of_rooms" => 'required|numeric',
|
||||
"currency" => 'required',
|
||||
"amount" => 'required|numeric',
|
||||
"total_amount" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferRoomMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferRoomMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"room_mapping" => 'required|array',
|
||||
"room_mapping.*" => 'required|numeric',
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [
|
||||
'room_mapping.required' => __('error-input-room_mapping-required')
|
||||
];
|
||||
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,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\OfferRoomMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class OfferRoomMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"offer_id" => 'required|numeric',
|
||||
"property_room_id" => '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());
|
||||
}
|
||||
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyAdditionalInfo;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyAdditionalInfoAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'data' => 'required|array',
|
||||
'data.*.additional_info_key_id' => 'required|numeric',
|
||||
'data.*.value' => 'required',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
47
app/Core/Validator/PropertyAddon/PropertyAddonValidator.php
Normal file
47
app/Core/Validator/PropertyAddon/PropertyAddonValidator.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyAddon;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
use App\Models\PropertyPlace;
|
||||
|
||||
class PropertyAddonValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"channel_id" => 'required|numeric',
|
||||
"property_addon_id" => 'required|numeric',
|
||||
'type' => 'required_without:status|in:ONT,PRP',
|
||||
'amount' => 'required_without:status|numeric',
|
||||
'status' => 'nullable|numeric'
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return parent::messages();
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyAwardsCertificate;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyAwardCertificateUploadValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'file' => 'nullable|mimes:jpg,jpeg,png,webp,gif,pdf|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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyAwardsCertificate;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyAwardsCertificateCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"category_id" => 'required|numeric',
|
||||
"name" => 'max:255',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyAwardsCertificate;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyAwardsCertificateUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"award_certificate_id" => 'required|numeric',
|
||||
"property_id" => 'required|numeric',
|
||||
"category_id" => 'required|numeric',
|
||||
"name" => 'max:255',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyBookingTicket;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyTicketCreateValidator extends BaseValidator
|
||||
{
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return [
|
||||
'user_id' => 'nullable|numeric',
|
||||
'booking_code' => 'required|string|min:18|max:18',
|
||||
'message' => 'required|string|max:2000',
|
||||
'is_note' => 'nullable|boolean',
|
||||
'ip_address' => 'required|ip',
|
||||
];
|
||||
}
|
||||
|
||||
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,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyBookingTicket;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyTicketGetValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return [
|
||||
'user_id' => 'nullable|numeric',
|
||||
'booking_code' => 'required|string|min:18|max:18',
|
||||
];
|
||||
}
|
||||
|
||||
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,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyCancellationPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyCancellationPolicyAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'name' => 'nullable',
|
||||
'before_arrival' => 'required|numeric',
|
||||
'is_nonrefundable' => 'required|boolean',
|
||||
'is_free_cancellation' => 'required|boolean',
|
||||
'type' => 'nullable|in:PER,FIX,NGT',
|
||||
'value' => 'nullable|numeric',
|
||||
'affects_price' => 'required|boolean',
|
||||
'affects_price_action_type' => 'nullable|in:INC,DEC',
|
||||
'affects_price_type' => 'nullable|in:PER,FIX',
|
||||
'affects_price_value' => 'nullable|numeric',
|
||||
'is_date_range' => 'required|boolean',
|
||||
'start_date' => 'required_without:is_date_range|date',
|
||||
'finish_date' => 'required_without:is_date_range|date|after:start_date',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyCancellationPolicy;
|
||||
|
||||
use App\Models\PropertyCancellationPolicy;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyCancellationPolicyUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'cancellation_policy_id' => 'required|numeric',
|
||||
'name' => 'nullable',
|
||||
'before_arrival' => 'required|numeric',
|
||||
'is_nonrefundable' => 'required|boolean',
|
||||
'is_free_cancellation' => 'required|boolean',
|
||||
'type' => 'nullable|in:PER,FIX,NGT',
|
||||
'value' => 'nullable|numeric',
|
||||
'affects_price' => 'required|boolean',
|
||||
'affects_price_action_type' => 'nullable|in:INC,DEC',
|
||||
'affects_price_type' => 'nullable|in:PER,FIX',
|
||||
'affects_price_value' => 'nullable|numeric',
|
||||
'checkData' => 'accepted',
|
||||
'is_date_range' => 'required|boolean',
|
||||
'start_date' => 'required_without:is_date_range|date',
|
||||
'finish_date' => 'required_without:is_date_range|date|after:start_date',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkData($params){
|
||||
|
||||
$data = PropertyCancellationPolicy::where('id' , '=', $params['cancellation_policy_id'])
|
||||
->where('property_id' , '=', $params['property_id'])
|
||||
->first();
|
||||
return $data ? true : false ;
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkData"] = $this->checkData($params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyCancellationPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UpdateRoomRateChannelCancellationPolicyValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channel_id' => 'required|numeric',
|
||||
'room_rate_channel_mapping_id' => 'required|numeric',
|
||||
'cancellation_policy_id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannel;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'required',
|
||||
'channel_category_id' => 'required|numeric',
|
||||
'currency_code' => 'required',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannel;
|
||||
|
||||
use App\Models\Property;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelDeleteValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => '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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannel;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => 'required|numeric',
|
||||
'name' => 'required',
|
||||
'channel_category_id' => 'required|numeric',
|
||||
'currency_code' => 'required',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelBookingPaymentSetup;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyChannelBookingPaymentSetupAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"channel_id" => 'required|numeric',
|
||||
"payments" => 'nullable|array',
|
||||
"payments.*.payment_type_id" => 'required|numeric',
|
||||
"payments.*.is_affected_price" => 'required|boolean',
|
||||
"payments.*.action_type" => 'nullable|in:INC,DEC',
|
||||
"payments.*.value_type" => 'nullable|in:FIX,PER',
|
||||
"payments.*.value" => 'nullable|numeric',
|
||||
"payments.*.is_selected" => 'required|boolean',
|
||||
"payments.*.cancellation_policy" => 'present|array|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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelCoupon;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
use App\Models\PropertyPlace;
|
||||
|
||||
class PropertyChannelCouponValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"channel_id" => 'required|numeric',
|
||||
"code" => 'required',
|
||||
"start_date" => 'required|date',
|
||||
"end_date" => 'required|date',
|
||||
'type' => 'required|in:PER,FIX',
|
||||
'value' => 'required|numeric',
|
||||
'status' => 'nullable|boolean'
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return parent::messages();
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channels' => 'required|array',
|
||||
'channels.*' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelMappingRemoveValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channels' => 'required|array',
|
||||
'channels.*' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelMappingUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_channel' => 'required|array',
|
||||
'property_channel.*.id' => 'required|numeric',
|
||||
'property_channel.*.is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelMapping;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelSetupValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
$rules =
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channel_id' => 'required|numeric',
|
||||
'checkPayment' => 'accepted',
|
||||
'booking' => 'array',
|
||||
'payment' => 'array',
|
||||
'availability' => 'array',
|
||||
'availability.availability_type_id' => 'numeric',
|
||||
|
||||
] ;
|
||||
|
||||
|
||||
if(isset($params['booking']['value'])){
|
||||
$optionalRules = [
|
||||
'booking.booking_type_id' => 'required|numeric',
|
||||
'booking.action_type' => 'required|in:INC,DEC',
|
||||
'booking.value_type' => 'required|in:FIX,PER',
|
||||
'booking.value' => 'numeric',
|
||||
] ;
|
||||
$rules = array_merge($rules, $optionalRules) ;
|
||||
}
|
||||
|
||||
return $rules ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function paymentValueControl($params){
|
||||
try {
|
||||
$errorStatus = false ;
|
||||
|
||||
foreach ($params['payment'] as $payment) {
|
||||
if(
|
||||
($payment['value']) &&
|
||||
(
|
||||
$payment['action_type'] == null || $payment['value_type'] == null ||
|
||||
!in_array($payment['action_type'], ['INC', 'DEC']) || !in_array($payment['value_type'], ['FIX', 'PER'])
|
||||
|
||||
)
|
||||
){
|
||||
$errorStatus = true ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $errorStatus ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkPayment"] = $this->paymentValueControl($params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelSetup;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelSetupAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required',
|
||||
'channel_id' => 'required',
|
||||
'currency_code' => 'nullable|string|required_without:connected_channel_id',
|
||||
'booking_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'availability_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'room_pricing_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'connected_channel_id' => 'nullable|numeric|required_without:currency_code',
|
||||
'connected_channel_action' => 'nullable|string|required_with:connected_channel_id'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelSetup;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelSetupUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required',
|
||||
'channel_id' => 'required',
|
||||
'currency_code' => 'nullable|string|required_without:connected_channel_id',
|
||||
'booking_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'availability_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'room_pricing_type_id' => 'nullable|numeric|required_without:connected_channel_id',
|
||||
'connected_channel_id' => 'nullable|numeric|required_without:currency_code',
|
||||
'connected_channel_action' => 'nullable|string|required_with:connected_channel_id'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyChannelSetup;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyChannelSetupWithMissingParametersAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required',
|
||||
'channel_id' => 'required'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyConfig;
|
||||
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyConfigCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|integer',
|
||||
'config_key' => 'required',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyContact;
|
||||
|
||||
|
||||
use GPBMetadata\Google\Api\Log;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use App\Core\Repository\PropertyContact\PropertyContactRepository;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyContactCreateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyContactRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyContactRepository $propertyContactRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyContactRepository = $propertyContactRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
// 'property_id' => 'required|integer|unique:property_contact,property_id', // todo: It should be added uniqueness
|
||||
"checkMainPhoneAndMobilePhone" => "accepted",
|
||||
'phone' => 'nullable|max:50',
|
||||
'mobile' => 'nullable|max:50',
|
||||
'mobile2' => 'nullable|max:50',
|
||||
'fax' => 'nullable|max:50',
|
||||
'email' => 'required|email|max:100',
|
||||
'web' => 'nullable|max:100',
|
||||
'zip_code' => 'nullable|max:20',
|
||||
'address' => 'nullable|max:200',
|
||||
'latitude' => 'nullable',
|
||||
'longitude' => 'nullable',
|
||||
'status' => 'required|integer|max:4',
|
||||
'created_by' => 'required|integer',
|
||||
'updated_by' => 'required|integer',
|
||||
'social_media_addresses' => 'nullable|json|max:512',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [
|
||||
'checkMainPhoneAndMobilePhone.accepted' => 'phone or mobile phone required' // TODO : language key eklenicek
|
||||
];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function checkMainPhoneAndMobilePhone($params)
|
||||
{
|
||||
if (empty($params['phone']) && empty($params['mobile'])) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkMainPhoneAndMobilePhone"] = $this->checkMainPhoneAndMobilePhone( $params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Core\Validator\PropertyContact;
|
||||
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use App\Core\Repository\PropertyContact\PropertyContactRepository;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyContactUpdateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyContactRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyContactRepository $propertyContactRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyContactRepository = $propertyContactRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"checkMainPhoneAndMobilePhone" => "accepted",
|
||||
'email' => 'required|email|max:100',
|
||||
'phone' => 'nullable|max:50',
|
||||
'mobile' => 'nullable|max:50',
|
||||
'mobile2' => 'nullable|max:50',
|
||||
'fax' => 'nullable|max:50',
|
||||
'web' => 'nullable|max:100',
|
||||
'zip_code' => 'nullable|max:20',
|
||||
'address' => 'nullable|max:200',
|
||||
'latitude' => 'nullable',
|
||||
'longitude' => 'nullable',
|
||||
'social_media_addresses' => 'nullable|json|max:512',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [
|
||||
'checkMainPhoneAndMobilePhone.accepted' => 'phone or mobile phone required' // TODO : language key eklenicek
|
||||
];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkMainPhoneAndMobilePhone($params)
|
||||
{
|
||||
if (empty($params['phone']) && empty($params['mobile'])) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkMainPhoneAndMobilePhone"] = $this->checkMainPhoneAndMobilePhone($params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyContent;
|
||||
|
||||
use App\Core\Repository\PropertyContent\PropertyContentRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyContentCreateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyContentRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyContentRepository $propertyContentRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyContentRepository = $propertyContentRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required',
|
||||
'content_category_id' => 'required',
|
||||
'locale' => 'required|string|max:2',
|
||||
'status' => 'required|integer|max:4',
|
||||
'created_by' => 'required|integer',
|
||||
'updated_by' => 'required|integer',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyExecutive;
|
||||
|
||||
use App\Core\Repository\PropertyExecutive\PropertyExecutiveRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyExecutiveCreateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyExecutiveRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyExecutiveRepository $propertyExecutiveRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyExecutiveRepository = $propertyExecutiveRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'executive_type_id' => 'required|numeric',
|
||||
'name_surname' => 'required|max:50',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'extension' => 'nullable|max:10',
|
||||
'phone' => 'nullable|max:50',
|
||||
'mobile' => 'nullable|max:50',
|
||||
'fax' => 'nullable|max:50',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyExecutive;
|
||||
|
||||
use App\Core\Repository\PropertyExecutive\PropertyExecutiveRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyExecutiveUpdateValidator extends BaseValidator
|
||||
{
|
||||
private $propertyExecutiveRepository;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
PropertyExecutiveRepository $propertyExecutiveRepository,
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->propertyExecutiveRepository = $propertyExecutiveRepository;
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'executive_type_id' => 'required|numeric',
|
||||
'name_surname' => 'required|max:50',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'extension' => 'nullable|max:10',
|
||||
'phone' => 'nullable|max:50',
|
||||
'mobile' => 'nullable|max:50',
|
||||
'fax' => 'nullable|max:50',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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\PropertyFact;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyFactCheckboxValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_fact' => 'required|array',
|
||||
'property_fact.*.id' => 'required|numeric',
|
||||
'property_fact.*.is_selected' => 'required|boolean'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
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,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyFact;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyFactSearchValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'search_term' => 'nullable|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,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyNonrefundable;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
|
||||
class PropertyNonrefundableAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"channels" => 'required|array',
|
||||
"channels.*" => 'required|integer',
|
||||
"room_rate_mapping" => 'required|array',
|
||||
"room_rate_mapping.*.room_rate_mapping_id" => 'required|numeric',
|
||||
"room_rate_mapping.*.action_type" => 'required|in:DEC,INC',
|
||||
"room_rate_mapping.*.value_type" => 'required|in:PER,FIX',
|
||||
"room_rate_mapping.*.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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPayment;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyPaymentTransactionCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"title" => 'required',
|
||||
"description" => 'required',
|
||||
"email" => 'nullable|email',
|
||||
"currency" => "required",
|
||||
"base_amount" => "required|numeric",
|
||||
"commission" => "required|numeric",
|
||||
"payment_method" => "required|in:online,offline",
|
||||
"payment_type_mapping_id" => "nullable|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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPayment;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyPaymentTransactionUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"order_id" => 'required',
|
||||
"title" => 'required',
|
||||
"description" => 'required',
|
||||
"email" => 'nullable|email',
|
||||
"currency" => "required",
|
||||
"base_amount" => "required|numeric",
|
||||
"commission" => "required|numeric",
|
||||
"payment_method" => "required|in:online,offline",
|
||||
"payment_type_mapping_id" => "nullable|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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPaymentMapping;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPaymentInstallmentsUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_payment_mapping_id' => 'required|numeric',
|
||||
'has_installments' => 'required|boolean',
|
||||
'installments' => 'array',
|
||||
'installments.*.installment' => 'required|numeric',
|
||||
'installments.*.commission' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPaymentMapping;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPaymentMappingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'payment_type_id' => 'required|numeric',
|
||||
'currency' => 'required',
|
||||
'is_default' => 'required|boolean',
|
||||
'fields' => 'required|array',
|
||||
'check_fields' => 'accepted',
|
||||
'check_currencies' => 'accepted',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkFields($params)
|
||||
{
|
||||
try {
|
||||
$fields = PaymentType::where('status', 1)
|
||||
->where('id', $params['payment_type_id'])
|
||||
->first();
|
||||
if(!$fields){
|
||||
throw new Exception ('fields error');
|
||||
}
|
||||
$fields = json_decode($fields['params']);
|
||||
$apiKeys = $params['fields'];
|
||||
$requiredKeys = collect($fields)->keys()->all() ;
|
||||
foreach ($requiredKeys as $key) {
|
||||
if(!isset($apiKeys[$key])){
|
||||
throw new Exception('field error') ;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkCurrencies($params)
|
||||
{
|
||||
try {
|
||||
$currencies = Currency::get('code')->toArray() ;
|
||||
if(!$currencies){
|
||||
throw new Exception ('currency error');
|
||||
}
|
||||
|
||||
$apiCurrency = $params['currency'];
|
||||
$requiredCurrencies = collect($currencies)->keyBy('code')->keys()->all() ;
|
||||
|
||||
$arraySearch = in_array($apiCurrency, $requiredCurrencies) ;
|
||||
if(!$arraySearch){
|
||||
throw new Exception ('valid currency error');
|
||||
}
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["check_fields"] = $this->checkFields($params);
|
||||
$params["check_currencies"] = $this->checkCurrencies($params);
|
||||
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPaymentMapping;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPaymentMappingSetDefaultValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_payment_mapping_id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPaymentMapping;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPaymentMappingStatusUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_payment_mapping_id' => 'required|numeric',
|
||||
'set_status' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPaymentMapping;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPaymentMappingUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_payment_mapping_id' => 'required|numeric',
|
||||
'is_default' => 'required|boolean',
|
||||
'fields' => 'required|array',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
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,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use App\Models\PropertyPricingPolicyAdult;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPricingPolicyAdultAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'nullable',
|
||||
'adult_action_type' => 'required|in:DEC,INC',
|
||||
'adult' => 'required|numeric',
|
||||
'action_type' => 'required|in:DEC,INC',
|
||||
'type' => 'required|in:PER,FIX',
|
||||
'value' => 'required|numeric',
|
||||
// "checkPricingName" => "accepted"
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkPricingName($params)
|
||||
{
|
||||
try {
|
||||
$isExistPricingName = PropertyPricingPolicyAdult::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
|
||||
return $isExistPricingName ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
// $params["checkPricingName"] = $this->checkPricingName(['property_id' => $params["property_id"], 'name' => $params["name"]]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyPricingPolicyAdult;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPricingPolicyAdultUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'pricing_policy_id' => 'required|numeric',
|
||||
'name' => 'nullable',
|
||||
'adult_action_type' => 'required|in:DEC,INC',
|
||||
'adult' => 'required|numeric',
|
||||
'action_type' => 'required|in:DEC,INC',
|
||||
'type' => 'required|in:PER,FIX',
|
||||
'value' => 'required|numeric',
|
||||
'checkData' => 'accepted',
|
||||
// "checkPricingName" => "accepted"
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function checkData($params){
|
||||
|
||||
$data = PropertyPricingPolicyAdult::where('id' , '=', $params['pricing_policy_id'])
|
||||
->where('property_id' , '=', $params['property_id'])
|
||||
->first();
|
||||
return $data ? true : false ;
|
||||
}
|
||||
|
||||
public function checkPricingName($params)
|
||||
{
|
||||
try {
|
||||
$isExistPricingName = PropertyPricingPolicyAdult::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
|
||||
return $isExistPricingName && $isExistPricingName['id'] !== $params['pricing_policy_id'] ? false : true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkData"] = $this->checkData($params);
|
||||
/* $params["checkPricingName"] = $this->checkPricingName([
|
||||
'property_id' => $params["property_id"],
|
||||
'name' => $params["name"],
|
||||
'pricing_policy_id' => $params['pricing_policy_id']
|
||||
]);*/
|
||||
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyPricingPolicyChild;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPricingPolicyChildAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'nullable',
|
||||
'adult' => 'required|numeric',
|
||||
'child_order' => 'required|numeric',
|
||||
'child_age_start' => 'required|numeric',
|
||||
'child_age_end' => 'required|numeric',
|
||||
'type' => 'required|in:PER,FIX',
|
||||
'value' => 'required|numeric',
|
||||
//"checkPricingName" => "accepted"
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function checkPricingName($params)
|
||||
{
|
||||
try {
|
||||
$isExistPricingName = PropertyPricingPolicyChild::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
|
||||
return $isExistPricingName ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
// $params["checkPricingName"] = $this->checkPricingName(['property_id' => $params["property_id"], 'name' => $params["name"]]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use App\Models\PropertyPricingPolicyAdult;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyPricingPolicyChild;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPricingPolicyChildUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'name' => 'nullable',
|
||||
'adult' => 'required|numeric',
|
||||
'child_order' => 'required|numeric',
|
||||
'child_age_start' => 'required|numeric',
|
||||
'child_age_end' => 'required|numeric',
|
||||
'type' => 'required|in:PER,FIX',
|
||||
'value' => 'required|numeric',
|
||||
'checkData' => 'accepted',
|
||||
// "checkPricingName" => "accepted"
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkData($params){
|
||||
|
||||
$data = PropertyPricingPolicyChild::where('id' , '=', $params['pricing_policy_id'])
|
||||
->where('property_id' , '=', $params['property_id'])
|
||||
->first();
|
||||
return $data ? true : false ;
|
||||
}
|
||||
|
||||
public function checkPricingName($params)
|
||||
{
|
||||
try {
|
||||
$isExistPricingName = PropertyPricingPolicyChild::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
|
||||
return $isExistPricingName && $isExistPricingName['id'] !== $params['pricing_policy_id'] ? false : true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkData"] = $this->checkData($params);
|
||||
/* $params["checkPricingName"] = $this->checkPricingName([
|
||||
'property_id' => $params["property_id"],
|
||||
'name' => $params["name"],
|
||||
'pricing_policy_id' => $params['pricing_policy_id']
|
||||
]);*/
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UpdateRoomRateChannelPersonPricingAdultPolicyValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channel_id' => 'required|numeric',
|
||||
'room_rate_channel_mapping_id' => 'required|numeric',
|
||||
'pricing_policy_adult_id' => 'required|numeric',
|
||||
'is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPersonPricingPolicy;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UpdateRoomRateChannelPersonPricingChildPolicyValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType ;
|
||||
private $valueType ;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channel_id' => 'required|numeric',
|
||||
'room_rate_channel_mapping_id' => 'required|numeric',
|
||||
'pricing_policy_child_id' => 'required|numeric',
|
||||
'is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPlace;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
use App\Models\PropertyPlace ;
|
||||
|
||||
class PropertyPlaceCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"place_category_id" => 'required|numeric',
|
||||
"place_working_hour_id" => 'required|numeric',
|
||||
"name" => 'required|min:1|max:50',
|
||||
"reservation_requirement" => "required|boolean",
|
||||
"include" => "nullable|numeric",
|
||||
"hasName" => "accepted",
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages =
|
||||
[
|
||||
"hasName.accepted" => "This name added before",
|
||||
];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function hasName($params)
|
||||
{
|
||||
try {
|
||||
$domain = PropertyPlace::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
return $domain ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["hasName"] = $this->hasName($params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPlace;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyPlaceFactMappingUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"place_id" => 'required|numeric',
|
||||
"place_fact_title_fact_mapping_id" => 'required|numeric',
|
||||
"is_selected" => "required|boolean",
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
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,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPlace;
|
||||
|
||||
use App\Models\PropertyPhoto;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyPlace;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPlacePhotoMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'place_id' => 'required|numeric',
|
||||
"checkPropertyPlace" => "accepted",
|
||||
"checkPropertyPhoto" => "accepted",
|
||||
'property_place_photo' => 'required|array',
|
||||
'property_place_photo.*.id' => 'required|numeric',
|
||||
'property_place_photo.*.is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkPropertyPlace($params)
|
||||
{
|
||||
try {
|
||||
$placeData = PropertyPlace::where('property_id', $params['property_id'])
|
||||
->where('id', $params['place_id'])
|
||||
->first();
|
||||
|
||||
return $placeData ? true : false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPropertyPhoto($params)
|
||||
{
|
||||
try {
|
||||
|
||||
$photos = collect($params['property_place_photo'])->keyBy('id')->keys()->toArray();
|
||||
$arrayCount = collect($params['property_place_photo'])->count();
|
||||
$photoData = PropertyPhoto::where('property_id', $params['property_id'])
|
||||
->whereIn('id', $photos)
|
||||
->count();
|
||||
return $arrayCount == $photoData ? true : false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkPropertyPlace"] = $this->checkPropertyPlace(['property_id' => $params["property_id"], 'place_id' => $params["place_id"] ]);
|
||||
$params["checkPropertyPhoto"] = $this->checkPropertyPhoto(['property_id' => $params["property_id"], 'property_place_photo' => $params["property_place_photo"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPlace;
|
||||
|
||||
use App\Models\PropertyPlace;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
class PropertyPlaceUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"place_category_id" => 'required|numeric',
|
||||
"place_working_hour_id" => 'required|numeric',
|
||||
"name" => 'required|min:1|max:50',
|
||||
"reservation_requirement" => "required|boolean",
|
||||
"include" => "nullable|numeric",
|
||||
"hasName" => "accepted",
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages =
|
||||
[
|
||||
"hasName.accepted" => "This name added before",
|
||||
];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function hasName($params)
|
||||
{
|
||||
try {
|
||||
$place = PropertyPlace::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->where('id', "!=", $params['property_place_id'])
|
||||
->first();
|
||||
return $place ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["hasName"] = $this->hasName($params);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPromotion;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PromotionType;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPromotionAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType;
|
||||
private $valueType;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
$return =
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'promotion_type_id' => 'required|numeric',
|
||||
'amount' => 'required|numeric|max:100',
|
||||
'days' => 'required|array',
|
||||
|
||||
];
|
||||
|
||||
$promotionType = PromotionType::where('id' , '=', $params['promotion_type_id'])
|
||||
->first();
|
||||
|
||||
$returnAdd = [];
|
||||
if($promotionType['type_code'] == 'PRD'){
|
||||
$returnAdd = [
|
||||
'start_date' => 'required|date_format:Y-m-d',
|
||||
'end_date' => 'required|date_format:Y-m-d',
|
||||
'reservation_start_date' => 'required|date_format:Y-m-d',
|
||||
'reservation_end_date' => 'required|date_format:Y-m-d',
|
||||
];
|
||||
}elseif($promotionType['type_code'] == 'BFD'){
|
||||
|
||||
$returnAdd = [
|
||||
'day_before' => 'required|numeric',
|
||||
];
|
||||
|
||||
}
|
||||
if($params['min_stay'] != null){
|
||||
$returnAdd['min_stay'] = 'numeric';
|
||||
}
|
||||
|
||||
|
||||
return array_merge($return, $returnAdd) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPromotion;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PromotionType;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyPromotionUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $setupType;
|
||||
private $valueType;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
$return =
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'promotion_type_id' => 'required|numeric',
|
||||
'amount' => 'required|numeric|max:100',
|
||||
'days' => 'required|array',
|
||||
|
||||
];
|
||||
|
||||
$promotionType = PromotionType::where('id' , '=', $params['promotion_type_id'])
|
||||
->first();
|
||||
|
||||
$returnAdd = [];
|
||||
if($promotionType['type_code'] == 'PRD'){
|
||||
$returnAdd = [
|
||||
'start_date' => 'required|date_format:Y-m-d',
|
||||
'end_date' => 'required|date_format:Y-m-d',
|
||||
'reservation_start_date' => 'required|date_format:Y-m-d',
|
||||
'reservation_end_date' => 'required|date_format:Y-m-d',
|
||||
];
|
||||
}elseif($promotionType['type_code'] == 'BFD'){
|
||||
$returnAdd = [
|
||||
'day_before' => 'required|numeric',
|
||||
];
|
||||
|
||||
}
|
||||
if($params['min_stay'] != null){
|
||||
$returnAdd['min_stay'] = 'numeric';
|
||||
}
|
||||
|
||||
|
||||
return array_merge($return, $returnAdd) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyPromotion;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UpdateRoomRateChannelPromotionValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'room_rate_channel_mapping_id' => 'required|numeric',
|
||||
'property_promotion_id' => 'required|numeric',
|
||||
'is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyQuickPricing;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Exception;
|
||||
use App\Core\Validator\BaseValidator;
|
||||
use App\Models\PropertyPlace;
|
||||
|
||||
class PropertyQuickPricingCreateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
"property_id" => 'required|numeric',
|
||||
"channel_id" => 'required|numeric',
|
||||
"room_rate_channel_mapping_id" => 'required|numeric',
|
||||
'action_type' => 'required|in:INC,DEC',
|
||||
'price_type' => 'required|in:PER,FIX',
|
||||
'price_value' => 'required|numeric',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return parent::messages();
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
69
app/Core/Validator/PropertyRoom/PropertyRoomAddValidator.php
Normal file
69
app/Core/Validator/PropertyRoom/PropertyRoomAddValidator.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'name' => 'required',
|
||||
"checkName" => "accepted",
|
||||
'room_type_id' => 'required|numeric',
|
||||
'room_type_count' => 'required|numeric',
|
||||
'max_occupancy' => 'required|numeric',
|
||||
'max_adult' => 'required|numeric',
|
||||
'max_child' => 'required|numeric',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkName($params)
|
||||
{
|
||||
try {
|
||||
$roomRate = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
return $roomRate ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkName"] = $this->checkName(['property_id' => $params["property_id"], 'name' => $params["name"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAndBedAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'name' => 'required|max:200',
|
||||
"checkName" => "accepted",
|
||||
'room_type_id' => 'required|numeric',
|
||||
'room_type_count' => 'required|numeric',
|
||||
'max_occupancy' => 'required|numeric|min:1',
|
||||
'max_adult' => 'required|numeric',
|
||||
'max_child' => 'required|numeric',
|
||||
'room_bed_group' => 'nullable|array',
|
||||
'room_bed_group.*' => 'nullable|array',
|
||||
'room_bed_group.*.*.bed_type_id' => 'nullable|numeric',
|
||||
'exclude_occupancy' => 'nullable|max:500',
|
||||
'room_size_type' => 'required|max:30',
|
||||
'room_size' => 'required|max:11',
|
||||
'is_connected_room' => 'nullable|boolean',
|
||||
'is_connected_room_price' => 'nullable|boolean',
|
||||
'is_connected_room_availability' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function checkName($params)
|
||||
{
|
||||
try {
|
||||
$roomRate = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->where('room_type_id', $params['room_type_id'])
|
||||
->where('status', 1)
|
||||
->first();
|
||||
return $roomRate ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkName"] = $this->checkName(['property_id' => $params["property_id"], 'name' => $params["name"], 'room_type_id' => $params['room_type_id'] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAndBedUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'room_id' => 'required|numeric',
|
||||
'name' => 'required|max:200',
|
||||
"checkName" => "accepted",
|
||||
'room_type_id' => 'required|numeric',
|
||||
'room_type_count' => 'required|numeric',
|
||||
'max_occupancy' => 'required|numeric|min:1',
|
||||
'max_adult' => 'required|numeric',
|
||||
'max_child' => 'required|numeric',
|
||||
'room_bed_group' => 'nullable|array',
|
||||
'room_bed_group.*' => 'nullable|array',
|
||||
'room_bed_group.*.*.bed_type_id' => 'nullable|numeric',
|
||||
'exclude_occupancy' => 'nullable|max:500',
|
||||
'room_size_type' => 'required|max:30',
|
||||
'room_size' => 'required|max:11',
|
||||
'is_connected_room' => 'nullable|boolean',
|
||||
'is_connected_room_price' => 'nullable|boolean',
|
||||
'is_connected_room_availability' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function checkName($params)
|
||||
{
|
||||
try {
|
||||
$roomRate = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->where('room_type_id', $params['room_type_id'])
|
||||
->where('id', '!=', $params['room_id'])
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
return $roomRate ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkName"] = $this->checkName(
|
||||
[
|
||||
'property_id' => $params["property_id"],
|
||||
'name' => $params["name"],
|
||||
'room_id' => $params['room_id'] ,
|
||||
'room_type_id' => $params['room_type_id']
|
||||
]);
|
||||
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use App\Models\Property;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomDeleteValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomFactMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'room_id' => 'required|numeric',
|
||||
"checkPropertyRoom" => "accepted",
|
||||
'property_room_fact' => 'required|array',
|
||||
'property_room_fact.*.id' => 'required|numeric',
|
||||
'property_room_fact.*.is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkPropertyRoom($params)
|
||||
{
|
||||
try {
|
||||
$roomData = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('id', $params['room_id'])
|
||||
->first();
|
||||
|
||||
return $roomData ? true : false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkPropertyRoom"] = $this->checkPropertyRoom(['property_id' => $params["property_id"], 'room_id' => $params["room_id"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomInventoryValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'channel_id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use App\Models\PropertyPhoto;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomPhotoMappingAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'room_id' => 'required|numeric',
|
||||
"checkPropertyRoom" => "accepted",
|
||||
"checkPropertyPhoto" => "accepted",
|
||||
'property_room_photo' => 'required|array',
|
||||
'property_room_photo.*.id' => 'required|numeric',
|
||||
'property_room_photo.*.is_selected' => 'required|boolean',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
public function checkPropertyRoom($params)
|
||||
{
|
||||
try {
|
||||
$roomData = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('id', $params['room_id'])
|
||||
->first();
|
||||
|
||||
return $roomData ? true : false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPropertyPhoto($params)
|
||||
{
|
||||
try {
|
||||
|
||||
$photos = collect($params['property_room_photo'])->keyBy('id')->keys()->toArray();
|
||||
$arrayCount = collect($params['property_room_photo'])->count();
|
||||
$photoData = PropertyPhoto::where('property_id', $params['property_id'])
|
||||
->whereIn('id', $photos)
|
||||
->count();
|
||||
return $arrayCount == $photoData ? true : false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$params["checkPropertyRoom"] = $this->checkPropertyRoom(['property_id' => $params["property_id"], 'room_id' => $params["room_id"] ]);
|
||||
$params["checkPropertyPhoto"] = $this->checkPropertyPhoto(['property_id' => $params["property_id"], 'property_room_photo' => $params["property_room_photo"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoom;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use App\Models\PropertyRoom;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => 'required|numeric',
|
||||
'name' => 'required',
|
||||
"checkName" => "accepted",
|
||||
'room_type_id' => 'required|numeric',
|
||||
'room_type_count' => 'required|numeric',
|
||||
'max_occupancy' => 'required|numeric',
|
||||
'max_adult' => 'required|numeric',
|
||||
'max_child' => 'required|numeric',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
public function checkName($params)
|
||||
{
|
||||
try {
|
||||
$roomRate = PropertyRoom::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->where('id', '!=' ,$params['id'])
|
||||
->first();
|
||||
return $roomRate ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
|
||||
$params["checkName"] = $this->checkName(['property_id' => $params["property_id"], 'name' => $params["name"], 'id' => $params["id"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomAvailability;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAvailabilityAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_room_id' => 'required|numeric',
|
||||
'room_rate_mapping_id' => 'required|numeric',
|
||||
'channel_id' => 'required|numeric',
|
||||
'min_stay' => 'required|numeric',
|
||||
'max_stay' => 'required|numeric',
|
||||
'stop_sell' => 'required|numeric',
|
||||
'booking_on_request' => 'required|numeric',
|
||||
'start_date' => 'required|date_format:Y-m-d',
|
||||
'end_date' => 'required|date_format:Y-m-d',
|
||||
'amount' => 'required|numeric',
|
||||
'currency' => 'required',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomAvailability;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAvailabilityBulkInsertValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $updateTypes ;
|
||||
private $includeDays;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
$this->updateTypes = ["availability","room_stop_sell"];
|
||||
$this->includeDays = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'update_type' => 'required|in:'.implode(',', $this->updateTypes),
|
||||
'value' => 'required|numeric',
|
||||
'start_date' => 'required|date_format:Y-m-d',
|
||||
'end_date' => 'required|date_format:Y-m-d',
|
||||
'availability_type_id' => 'required|in:1,2,3',
|
||||
'channel_id' => 'required|integer',
|
||||
|
||||
'room_rates' => 'required|array',
|
||||
'room_rates.*.room_id' => 'required|numeric',
|
||||
'room_rates.*.room_rate_mapping_id' => 'array',
|
||||
'include_days.*' => 'required|in:'.implode(',', $this->includeDays),
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
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,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomAvailability;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAvailabilityBulkUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
private $updateTypes ;
|
||||
private $includeDays;
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'availability' => 'array',
|
||||
'availability.*.setup_type_id' => 'required|numeric',
|
||||
'availability.*.room_id' => 'required|numeric',
|
||||
'availability.*.date' => 'required|date_format:Y-m-d',
|
||||
'availability.*.availability' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomAvailability;
|
||||
|
||||
use App\Models\Property;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAvailabilityDeleteValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomAvailability;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomAvailabilityUpdateValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'property_id' => 'required|numeric',
|
||||
'property_room_id' => 'required|numeric',
|
||||
'room_rate_mapping_id' => 'required|numeric',
|
||||
'channel_id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomBed;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomBedAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'room_id' => 'required|numeric',
|
||||
'bed_group' => 'required|numeric',
|
||||
'count' => 'required|numeric',
|
||||
'bed_type_id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomRate;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomRateAddValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return [
|
||||
'property_id' => 'required|numeric',
|
||||
'name' => 'required',
|
||||
'accommodation_type' => 'required|numeric',
|
||||
'min_stay' => 'required|numeric',
|
||||
'max_stay' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomRate;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use App\Models\PropertyRoomRate;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomRateAddWithInclusionValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return [
|
||||
'property_id' => 'required|numeric',
|
||||
'name' => 'required',
|
||||
"checkName" => "accepted",
|
||||
'accommodation_type' => 'required|numeric',
|
||||
/*'min_stay' => 'required|numeric',
|
||||
'max_stay' => 'required|numeric',*/
|
||||
'facts' => 'nullable|array',
|
||||
'facts.*' => 'nullable|numeric',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$thisMessages = [];
|
||||
return array_merge(parent::messages() , $thisMessages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function checkName($params)
|
||||
{
|
||||
try {
|
||||
$roomRate = PropertyRoomRate::where('property_id', $params['property_id'])
|
||||
->where('name', $params['name'])
|
||||
->first();
|
||||
return $roomRate ? false : true;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
|
||||
$params["checkName"] = $this->checkName(['property_id' => $params["property_id"], 'name' => $params["name"] ]);
|
||||
return $this->make($params, $this->rules($params), $this->messages());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Validator\PropertyRoomRate;
|
||||
|
||||
use App\Models\Property;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
|
||||
use App\Core\Validator\BaseValidator;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PropertyRoomRateDeleteValidator extends BaseValidator
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function __construct
|
||||
(
|
||||
|
||||
Translator $translator,
|
||||
Container $container
|
||||
)
|
||||
{
|
||||
parent::__construct($translator, $container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function rules($params = null)
|
||||
{
|
||||
return
|
||||
[
|
||||
'id' => '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());
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user