Refactor imports and formatting in various Filament resources; add SMS sending helper function
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class PhoneNumberVerificationModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification\Repositories;
|
||||
|
||||
class PhoneNumberVerificationRepository {}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class PhoneNumberVerificationRule implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! is_numeric($value)) {
|
||||
$fail('Telefon belgisi diňe sanlardan ybarat bolmaly.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$number = (int) $value;
|
||||
|
||||
$isValid = ($number >= 61000000 && $number <= 65999999) || ($number >= 71000000 && $number <= 71999999);
|
||||
|
||||
if (! $isValid) {
|
||||
$fail('Telefon belgisi nädogry aralykda.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Modules\UserCompany\Models;
|
||||
|
||||
use App\Modules\UserCompany\Types\CompanyType;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Modules\Bank\Models\Bank;
|
||||
use App\Modules\UserCompany\Types\CompanyType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @property int $id [primary,unique]
|
||||
|
||||
Reference in New Issue
Block a user