walletservice/app/Models/User.php

121 lines
2.7 KiB
PHP
Raw Permalink Normal View History

2020-06-01 18:31:25 +00:00
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class User
*
2020-06-01 18:31:25 +00:00
* @property int $id
* @property string $uid
* @property string $firstname
* @property string $lastname
* @property string $phone
* @property string $email
* @property string $user_code
2020-06-30 03:41:20 +00:00
* @property string $numero_carte
* @property Carbon $expiration_date
* * @property int|null $card_country_id
2020-06-01 18:31:25 +00:00
* @property string $adresse
* @property float $solde
* @property string $encrypted_password
* @property string $salt
* @property string $validation_code
* @property int $active
2022-01-24 11:04:40 +00:00
* @property boolean $qr_code
2020-06-01 18:31:25 +00:00
* @property Carbon $date_modified
* @property Carbon $date_created
* @property int $network_id
* @property int $group_id
2020-11-13 06:39:24 +00:00
* @property float $balance_credit
* @property float $balance_epargne
* @property Carbon|null $date_adhesion
* @property int|null $id_bank_country
* @property string|null $iban
*
2020-06-01 18:31:25 +00:00
* @property Collection|Identification[] $identifications
* @property Collection|WalletsUser[] $wallets_users
*
* @package App\Models
*/
class User extends Model
{
2020-06-30 03:41:20 +00:00
protected $table = 'users';
public $timestamps = false;
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
protected $casts = [
'solde' => 'float',
'active' => 'int',
'network_id' => 'int',
2020-11-13 06:39:24 +00:00
'group_id' => 'int',
'balance_credit' => 'float',
'balance_epargne' => 'float',
'id_bank_country' => 'int'
2020-06-30 03:41:20 +00:00
];
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
protected $dates = [
'expiration_date',
'date_modified',
2020-11-13 06:39:24 +00:00
'date_created',
'date_adhesion'
2020-06-30 03:41:20 +00:00
];
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
protected $hidden = [
'encrypted_password'
];
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
protected $fillable = [
'uid',
'firstname',
'lastname',
'phone',
'email',
'user_code',
2020-06-30 03:41:20 +00:00
'numero_carte',
'expiration_date',
'card_country_id',
2020-06-30 03:41:20 +00:00
'adresse',
'solde',
'encrypted_password',
'salt',
'validation_code',
'active',
2022-01-24 11:04:40 +00:00
'qr_code',
2020-06-30 03:41:20 +00:00
'date_modified',
2020-11-13 06:39:24 +00:00
'date_created',
'group_id',
'balance_credit',
'balance_epargne',
'date_adhesion',
'id_bank_country',
'iban'
2020-06-30 03:41:20 +00:00
];
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
public function identifications()
{
return $this->hasMany(Identification::class, 'id_user');
}
2020-06-01 18:31:25 +00:00
2020-06-30 03:41:20 +00:00
public function wallets_users()
{
return $this->hasMany(WalletsUser::class, 'idUser');
}
2020-06-24 07:36:54 +00:00
public function network()
{
return $this->belongsTo(Network::class, 'network_id');
}
2020-11-13 06:39:24 +00:00
public function bank()
{
return $this->belongsTo(NetworksOperator::class, 'id_bank_country', 'id_operator_country');
}
2020-06-01 18:31:25 +00:00
}