Add gold credit feature gated by SuperAdmin enable_gold_credit.
Port tables, APIs, and overdue cron from goldali, default the flag off, and keep customer routes behind auth. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class GoldCredit extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'customer_id',
|
||||
'gold_amount',
|
||||
'months',
|
||||
'interest_type',
|
||||
'interest_value',
|
||||
'delivery_method',
|
||||
'status',
|
||||
'source',
|
||||
'total_interest_gold',
|
||||
'total_payable_gold',
|
||||
'paid_gold',
|
||||
'paid_rial',
|
||||
'created_by',
|
||||
'notes',
|
||||
'has_check',
|
||||
'has_contract',
|
||||
'check_note',
|
||||
'contract_note',
|
||||
'penalty_type',
|
||||
'penalty_amount',
|
||||
'grace_hours',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'gold_amount' => 'float',
|
||||
'interest_value' => 'float',
|
||||
'total_interest_gold' => 'float',
|
||||
'total_payable_gold' => 'float',
|
||||
'paid_gold' => 'float',
|
||||
'paid_rial' => 'integer',
|
||||
'has_check' => 'boolean',
|
||||
'has_contract' => 'boolean',
|
||||
'penalty_amount' => 'float',
|
||||
];
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function installments(): HasMany
|
||||
{
|
||||
return $this->hasMany(GoldCreditInstallment::class)->orderBy('installment_number');
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user