Work on cards
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Models\Order\Card;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CardOrder extends Model
|
||||
@@ -17,6 +19,75 @@ class CardOrder extends Model
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
|
||||
'unique_id',
|
||||
'card_state_id',
|
||||
'card_type_id',
|
||||
'region',
|
||||
'branch_id',
|
||||
'customer_name',
|
||||
'customer_surname',
|
||||
'customer_patronic_name',
|
||||
'born_at',
|
||||
'old_surname',
|
||||
'citizenship',
|
||||
'passport_serie',
|
||||
'passport_id',
|
||||
'passport_given_at',
|
||||
'passport_given_by',
|
||||
'born_place',
|
||||
'job_location',
|
||||
'passport_address',
|
||||
'real_address',
|
||||
'phone',
|
||||
'phone_additional',
|
||||
'status',
|
||||
'passport_one',
|
||||
'passport_two',
|
||||
'passport_three',
|
||||
'passport_four',
|
||||
'notes',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'born_at' => 'date',
|
||||
'passport_given_at' => 'date',
|
||||
];
|
||||
|
||||
/**
|
||||
* User
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Card state
|
||||
*/
|
||||
public function cardState(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardState::class, 'card_state_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Card type
|
||||
*/
|
||||
public function cardType(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardType::class, 'card_type_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Branch
|
||||
*/
|
||||
public function branch(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Branch::class, 'branch_id');
|
||||
}
|
||||
}
|
||||
|
||||
30
app/Models/Order/Card/CardState.php
Normal file
30
app/Models/Order/Card/CardState.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Order\Card;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class CardState extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'price',
|
||||
];
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['name'];
|
||||
}
|
||||
30
app/Models/Order/Card/CardType.php
Normal file
30
app/Models/Order/Card/CardType.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Order\Card;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class CardType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'price',
|
||||
];
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['name'];
|
||||
}
|
||||
@@ -13,9 +13,9 @@ use Laravel\Nova\Actions\Actionable;
|
||||
|
||||
class LoanOrder extends Model
|
||||
{
|
||||
use Actionable;
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
use Actionable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@@ -55,7 +55,6 @@ class LoanOrder extends Model
|
||||
'passport_two',
|
||||
'passport_three',
|
||||
'passport_four',
|
||||
'filled_by',
|
||||
'user_id',
|
||||
'status',
|
||||
'status_reason',
|
||||
@@ -104,12 +103,4 @@ class LoanOrder extends Model
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* User who revieved order
|
||||
*/
|
||||
public function filledBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'filled_by');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user