add card pins

This commit is contained in:
2025-11-02 22:22:36 +05:00
parent fa304450cb
commit bdcb4811c4
4 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Modules\CardPinOrder;
use App\Modules\Makeable;
use App\Modules\ModuleContract;
class CardPinOrderModule 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;
}
/**
* Get module composer requirements
*/
public function getComposerRequirements(): array
{
return [];
}
/**
* Get module composer suggestions
*/
public function getComposerSuggestions(): array
{
return [];
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
SChema::create('card_pin_orders', function (Blueprint $table) {
$table->id();
$table->string('unique_id')->nullable()->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('card_type_id')->constrained('card_types')->restrictOnDelete();
$table->string('card_number');
// Region & Branch
$table->string('region', 2);
$table->foreignId('branch_id')->constrained('branches')->restrictOnDelete();
// Customer name,surname,patronic name
$table->string('customer_name')->index();
$table->string('customer_surname')->index();
$table->string('customer_patronic_name')->nullable();
$table->date('born_at')->nullable();
$table->string('phone')->index()->nullable();
$table->string('passport_serie')->index();
$table->string('passport_id')->index();
$table->text('passport_one')->nullable();
$table->text('passport_two')->nullable();
$table->text('passport_three')->nullable();
$table->text('passport_four')->nullable();
$table->string('status')->nullable();
$table->string('notes')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@@ -0,0 +1,76 @@
<?php
namespace App\Modules\CardPinOrder\Models;
use App\Models\User;
use App\Modules\Branch\Models\Branch;
use App\Modules\CardOrder\Models\CardType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @param int $id
*
* @property string unique_id
* @property int $user_id
* @property int $card_type_id
* @property string $card_number
* @property string $region
* @property int $branch_id
* @property string $customer_name
* @property string $customer_surname
* @property string $customer_patronic_name
* @property date $born_at
* @property string $phone
* @property string $passport_serie
* @property string $passport_id
* @property text $passport_one
* @property text $passport_two
* @property text $passport_three
* @property text $passport_four
* @property string $status
* @property null|string $notes
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*/
class CardPinOrder extends Model
{
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'born_at' => 'date',
];
/**
* User
*
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Card type
*
* @return BelongsTo<CardType, $this>
*/
public function cardType(): BelongsTo
{
return $this->belongsTo(CardType::class, 'card_type_id');
}
/**
* Branch
*
* @return BelongsTo<Branch, $this>
*/
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class);
}
}

View File

@@ -0,0 +1,5 @@
<?php
namespace App\Modules\CardPinOrder\Repositories;
class CardPinOrderRepository {}