| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Created by Reliese Model. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace App\Models; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Carbon\Carbon; | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Model; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Class WalletTransaction | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @property int $id | 
					
						
							|  |  |  |  * @property float $montant | 
					
						
							|  |  |  |  * @property string $numCarte | 
					
						
							| 
									
										
										
										
											2020-12-03 19:01:09 +00:00
										 |  |  |  * @property string $facade | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |  * @property Carbon $expiration_date | 
					
						
							|  |  |  |  * @property float $commission_banque | 
					
						
							|  |  |  |  * @property float $commission_ag | 
					
						
							|  |  |  |  * @property float $commission_sup | 
					
						
							|  |  |  |  * @property float $commission_hyp | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |  * @property string $type | 
					
						
							|  |  |  |  * @property Carbon $date | 
					
						
							|  |  |  |  * @property string $statut | 
					
						
							|  |  |  |  * @property string $result | 
					
						
							|  |  |  |  * @property int $id_wallet | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |  * @property int $id_wallet_sup | 
					
						
							|  |  |  |  * @property int $id_wallet_hyp | 
					
						
							| 
									
										
										
										
											2020-06-08 18:52:58 +00:00
										 |  |  |  * @property string $canceled | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @property Wallet $wallet | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |  * @property Wallet $wallet_sup | 
					
						
							|  |  |  |  * @property Wallet $wallet_hyp | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package App\Models | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class WalletTransaction extends Model | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	protected $table = 'wallet_transaction'; | 
					
						
							|  |  |  | 	public $timestamps = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |     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' | 
					
						
							|  |  |  |     ]; | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	protected $dates = [ | 
					
						
							|  |  |  | 		'date', | 
					
						
							|  |  |  |         'expiration_date' | 
					
						
							|  |  |  | 	]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	protected $fillable = [ | 
					
						
							| 
									
										
										
										
											2020-12-03 19:01:09 +00:00
										 |  |  |         'montant', | 
					
						
							|  |  |  |         'numCarte', | 
					
						
							|  |  |  |         'facade', | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |         'expiration_date', | 
					
						
							| 
									
										
										
										
											2020-04-21 14:07:57 +00:00
										 |  |  |         'commission_banque', | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |         'commission_ag', | 
					
						
							|  |  |  |         'commission_sup', | 
					
						
							|  |  |  |         'commission_hyp', | 
					
						
							| 
									
										
										
										
											2020-12-03 19:01:09 +00:00
										 |  |  |         'type', | 
					
						
							|  |  |  |         'date', | 
					
						
							|  |  |  |         'statut', | 
					
						
							|  |  |  |         'result', | 
					
						
							|  |  |  |         'id_wallet', | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |         'id_wallet_sup', | 
					
						
							| 
									
										
										
										
											2020-06-08 18:52:58 +00:00
										 |  |  |         'id_wallet_hyp', | 
					
						
							|  |  |  |         'canceled' | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  | 	]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	public function wallet() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return $this->belongsTo(Wallet::class, 'id_wallet'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-24 10:37:13 +00:00
										 |  |  |     public function wallet_sup() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->belongsTo(Wallet::class, 'id_wallet_sup'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function wallet_hyp() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->belongsTo(Wallet::class, 'id_wallet_hyp'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-21 14:07:57 +00:00
										 |  |  | //	public function getTaxeAttribute($value)
 | 
					
						
							|  |  |  | //    {
 | 
					
						
							|  |  |  | //        return ucfirst($value);
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //    public function setTaxeAttribute($value)
 | 
					
						
							|  |  |  | //    {
 | 
					
						
							|  |  |  | //        $this->attributes['taxe'] = (int) $value;
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function rules() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-05 17:00:16 +00:00
										 |  |  |         //Verifier si ce sont les infos de  la face avant ou arriere de la carte qui sont envoyés
 | 
					
						
							|  |  |  |         // front -> Face avant :  Numero de carte , cvv , etc...
 | 
					
						
							|  |  |  |         // back -> Face arriere : Numero de serie
 | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |         return [ | 
					
						
							| 
									
										
										
										
											2020-12-03 19:01:09 +00:00
										 |  |  |             'facade' => 'required_if:type,credit|in:front,back', | 
					
						
							|  |  |  |             'montant' => 'required|numeric|min:0|not_in:0', | 
					
						
							|  |  |  |             'numCarte' => 'required', | 
					
						
							|  |  |  |             'cvv' => 'required_if:facade,front|size:3', | 
					
						
							|  |  |  |             'expiration_date' => 'required_if:facade,front|date_format:m/y|after_or_equal:today', | 
					
						
							|  |  |  |             'type' => 'required|in:credit,debit', | 
					
						
							| 
									
										
										
										
											2020-06-11 13:42:35 +00:00
										 |  |  |             'id_wallet' => 'required|integer|min:0|not_in:0' | 
					
						
							| 
									
										
										
										
											2020-04-15 23:08:09 +00:00
										 |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |