add: full multi-tenancy control
This commit is contained in:
5
packages/Webkul/Core/src/Contracts/CoreConfig.php
Normal file
5
packages/Webkul/Core/src/Contracts/CoreConfig.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts;
|
||||
|
||||
interface CoreConfig {}
|
||||
5
packages/Webkul/Core/src/Contracts/Country.php
Normal file
5
packages/Webkul/Core/src/Contracts/Country.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts;
|
||||
|
||||
interface Country {}
|
||||
5
packages/Webkul/Core/src/Contracts/CountryState.php
Normal file
5
packages/Webkul/Core/src/Contracts/CountryState.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts;
|
||||
|
||||
interface CountryState {}
|
||||
30
packages/Webkul/Core/src/Contracts/Validations/Code.php
Executable file
30
packages/Webkul/Core/src/Contracts/Validations/Code.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts\Validations;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class Code implements Rule
|
||||
{
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return preg_match('/^[a-zA-Z]+[a-zA-Z0-9_]+$/', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return trans('core::app.validations.code');
|
||||
}
|
||||
}
|
||||
21
packages/Webkul/Core/src/Contracts/Validations/Decimal.php
Executable file
21
packages/Webkul/Core/src/Contracts/Validations/Decimal.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts\Validations;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class Decimal implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! preg_match('/^\d*(\.\d{1,4})?$/', $value)) {
|
||||
$fail(trans('admin::app.validations.message.decimal', ['attribute' => $attribute]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user