113 lines
2.4 KiB
PHP
Executable File
113 lines
2.4 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use phpDocumentor\Reflection\Types\Integer;
|
|
|
|
/**
|
|
* Class WalletTransaction
|
|
*
|
|
* @property int $id
|
|
* @property float $montant
|
|
* @property string $numCarte
|
|
* @property Carbon $expiration_date
|
|
* @property float $commission_banque
|
|
* @property float $commission_ag
|
|
* @property float $commission_sup
|
|
* @property float $commission_hyp
|
|
* @property string $type
|
|
* @property Carbon $date
|
|
* @property string $statut
|
|
* @property string $result
|
|
* @property int $id_wallet
|
|
* @property int $id_wallet_sup
|
|
* @property int $id_wallet_hyp
|
|
*
|
|
* @property Wallet $wallet
|
|
* @property Wallet $wallet_sup
|
|
* @property Wallet $wallet_hyp
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class WalletTransaction extends Model
|
|
{
|
|
protected $table = 'wallet_transaction';
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'montant' => 'float',
|
|
'commission_banque' => 'float',
|
|
'commission_ag' => 'float',
|
|
'commission_sup' => 'float',
|
|
'commission_hyp' => 'float',
|
|
'id_wallet' => 'int',
|
|
'id_wallet_sup' => 'int',
|
|
'id_wallet_hyp' => 'int'
|
|
];
|
|
|
|
protected $dates = [
|
|
'date',
|
|
'expiration_date'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'montant',
|
|
'numCarte',
|
|
'expiration_date',
|
|
'commission_banque',
|
|
'commission_ag',
|
|
'commission_sup',
|
|
'commission_hyp',
|
|
'type',
|
|
'date',
|
|
'statut',
|
|
'result',
|
|
'id_wallet',
|
|
'id_wallet_sup',
|
|
'id_wallet_hyp'
|
|
];
|
|
|
|
public function wallet()
|
|
{
|
|
return $this->belongsTo(Wallet::class, 'id_wallet');
|
|
}
|
|
|
|
public function wallet_sup()
|
|
{
|
|
return $this->belongsTo(Wallet::class, 'id_wallet_sup');
|
|
}
|
|
|
|
public function wallet_hyp()
|
|
{
|
|
return $this->belongsTo(Wallet::class, 'id_wallet_hyp');
|
|
}
|
|
|
|
// public function getTaxeAttribute($value)
|
|
// {
|
|
// return ucfirst($value);
|
|
// }
|
|
//
|
|
// public function setTaxeAttribute($value)
|
|
// {
|
|
// $this->attributes['taxe'] = (int) $value;
|
|
// }
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
'montant'=> 'required|numeric|min:0|not_in:0',
|
|
'numCarte'=>'required',
|
|
'cvv'=>'required|integer|min:100|max:9999',
|
|
'expiration_date'=>'required|date_format:m/y|after_or_equal:today',
|
|
'type' =>'required|in:credit,debit',
|
|
'id_wallet' => 'required|integer|min:0'
|
|
];
|
|
}
|
|
}
|