walletservice/app/Models/CustomerAccountType.php

60 lines
1.2 KiB
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Network;
use App\Models\UserBankAccount;
class CustomerAccountType extends Model
{
/**
*
* @var string
*/
protected $table = 'customer_account_types';
/**
* Les attributs qui peuvent être assignés massivement.
*
* @var array
*/
protected $fillable = [
'network_id',
'name',
'product',
'description',
'opening_amount',
'opening_amount_payment_period_days',
'parent_id',
'active',
];
/**
* Les attributs qui doivent être convertis vers des types natifs.
*
* @var array
*/
protected $casts = [
'active' => 'boolean',
'opening_amount' => 'decimal:2',
'network_id' => 'integer',
'parent_id' => 'integer',
'opening_amount_payment_period_days' => 'integer',
];
/**
* Relation avec le Network (si applicable)
*/
public function network()
{
return $this->belongsTo(Network::class, 'network_id');
}
public function userBankAccount()
{
return $this->hasMany(UserBankAccount::class, 'customer_account_type_id');
}
}