167 lines
3.9 KiB
PHP
167 lines
3.9 KiB
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* Created by Reliese Model.
|
||
|
*/
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Carbon\Carbon;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
/**
|
||
|
* Class WalletIlinkTransaction
|
||
|
*
|
||
|
* @property int $id
|
||
|
* @property float $montant
|
||
|
* @property float $montant_retrait
|
||
|
* @property string $code_retrait
|
||
|
* @property int $status_retrait
|
||
|
* @property string $id_destinataire
|
||
|
* @property string $type_id_destinataire
|
||
|
* @property int $network_destinataire
|
||
|
* @property string $type_document_destinataire
|
||
|
* @property string $id_document_destinataire
|
||
|
* @property string $nom_destinataire
|
||
|
* @property string $prenom_destinataire
|
||
|
* @property string $nom_emetteur
|
||
|
* @property string $prenom_emetteur
|
||
|
* @property float $frais
|
||
|
* @property float $taxe
|
||
|
* @property string $numero_carte
|
||
|
* @property Carbon $expiration_date
|
||
|
* @property int $init_country
|
||
|
* @property int $final_country
|
||
|
* @property float $commission_banque
|
||
|
* @property float $commission_ag
|
||
|
* @property float $commission_sup
|
||
|
* @property float $commission_hyp
|
||
|
* @property int $id_wallet_user
|
||
|
* @property int $id_wallet_ag
|
||
|
* @property int $id_wallet_sup
|
||
|
* @property int $id_wallet_hyp
|
||
|
* @property int $canceled
|
||
|
* @property int $type
|
||
|
* @property Carbon $date
|
||
|
*
|
||
|
* @property Country $country
|
||
|
* @property Wallet $wallet
|
||
|
* @property WalletsUser $wallets_user
|
||
|
* @property TypeIlinkTransaction $type_ilink_transaction
|
||
|
* @property Network $network
|
||
|
*
|
||
|
* @package App\Models
|
||
|
*/
|
||
|
class WalletIlinkTransaction extends Model
|
||
|
{
|
||
|
protected $table = 'wallet_ilink_transaction';
|
||
|
public $timestamps = false;
|
||
|
|
||
|
protected $casts = [
|
||
|
'montant' => 'float',
|
||
|
'montant_retrait' => 'float',
|
||
|
'status_retrait' => 'int',
|
||
|
'network_destinataire' => 'int',
|
||
|
'frais' => 'float',
|
||
|
'taxe' => 'float',
|
||
|
'init_country' => 'int',
|
||
|
'final_country' => 'int',
|
||
|
'commission_banque' => 'float',
|
||
|
'commission_ag' => 'float',
|
||
|
'commission_sup' => 'float',
|
||
|
'commission_hyp' => 'float',
|
||
|
'id_wallet_user' => 'int',
|
||
|
'id_wallet_ag' => 'int',
|
||
|
'id_wallet_sup' => 'int',
|
||
|
'id_wallet_hyp' => 'int',
|
||
|
'canceled' => 'int',
|
||
|
'type' => 'int'
|
||
|
];
|
||
|
|
||
|
protected $dates = [
|
||
|
'expiration_date',
|
||
|
'date'
|
||
|
];
|
||
|
|
||
|
protected $fillable = [
|
||
|
'montant',
|
||
|
'montant_retrait',
|
||
|
'code_retrait',
|
||
|
'status_retrait',
|
||
|
'id_destinataire',
|
||
|
'type_id_destinataire',
|
||
|
'network_destinataire',
|
||
|
'type_document_destinataire',
|
||
|
'id_document_destinataire',
|
||
|
'nom_destinataire',
|
||
|
'prenom_destinataire',
|
||
|
'nom_emetteur',
|
||
|
'prenom_emetteur',
|
||
|
'frais',
|
||
|
'taxe',
|
||
|
'numero_carte',
|
||
|
'expiration_date',
|
||
|
'init_country',
|
||
|
'final_country',
|
||
|
'commission_banque',
|
||
|
'commission_ag',
|
||
|
'commission_sup',
|
||
|
'commission_hyp',
|
||
|
'id_wallet_user',
|
||
|
'id_wallet_ag',
|
||
|
'id_wallet_sup',
|
||
|
'id_wallet_hyp',
|
||
|
'canceled',
|
||
|
'type',
|
||
|
'date'
|
||
|
];
|
||
|
|
||
|
public function country()
|
||
|
{
|
||
|
return $this->belongsTo(Country::class, 'final_country');
|
||
|
}
|
||
|
|
||
|
public function wallet()
|
||
|
{
|
||
|
return $this->belongsTo(Wallet::class, 'id_wallet_sup');
|
||
|
}
|
||
|
|
||
|
public function wallets_user()
|
||
|
{
|
||
|
return $this->belongsTo(WalletsUser::class, 'id_wallet_user');
|
||
|
}
|
||
|
|
||
|
public function type_ilink_transaction()
|
||
|
{
|
||
|
return $this->belongsTo(TypeIlinkTransaction::class, 'type');
|
||
|
}
|
||
|
|
||
|
public function network()
|
||
|
{
|
||
|
return $this->belongsTo(Network::class, 'network_destinataire');
|
||
|
}
|
||
|
|
||
|
// Regles de validation
|
||
|
//Envoi de cash vers wallet iLink
|
||
|
public function first_rules()
|
||
|
{
|
||
|
return [
|
||
|
'user_code'=>'required',
|
||
|
'init_country' =>'required|integer|min:0|not_in:0',
|
||
|
'final_country' =>'required|integer|min:0|not_in:0',
|
||
|
'montant'=> 'required|numeric|min:0|not_in:0',
|
||
|
'password'=>'required'
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function card_rules()
|
||
|
{
|
||
|
return [
|
||
|
'montant'=> 'required|numeric|min:0|not_in:0',
|
||
|
'numero_carte'=>'required',
|
||
|
'cvv'=>'required_if:facade,front|size:3',
|
||
|
'expiration_date'=>'required_if:facade,front|date_format:m/y|after_or_equal:today',
|
||
|
];
|
||
|
}
|
||
|
}
|