walletservice/app/Models/Identification.php

97 lines
1.9 KiB
PHP
Raw 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\Model;
/**
* Class Identification
2020-06-11 13:42:35 +00:00
*
2020-06-01 18:31:25 +00:00
* @property int $id
* @property string $firstname
* @property string $lastname
* @property Carbon $birth_date
* @property string $town
2020-06-11 13:42:35 +00:00
* @property string $country
2020-06-01 18:31:25 +00:00
* @property string $identity_document
* @property string $id_identity_document
2020-06-11 13:42:35 +00:00
* @property Carbon $expiry_date_document
* @property int $id_user
2020-06-01 18:31:25 +00:00
* @property int $status
* @property Carbon $createdAt
* @property string $user_image
* @property string $document_image
2020-06-11 13:42:35 +00:00
* @property string $user_code
* @property int $idNetwork
*
2020-06-01 18:31:25 +00:00
* @property User $user
2020-06-11 13:42:35 +00:00
* @property Network $network
2020-06-01 18:31:25 +00:00
*
* @package App\Models
*/
class Identification extends Model
{
protected $table = 'identifications';
public $timestamps = false;
protected $casts = [
2020-06-11 13:42:35 +00:00
'id_user' => 'int',
'status' => 'int',
'idNetwork' => 'int'
2020-06-01 18:31:25 +00:00
];
protected $dates = [
'birth_date',
2020-06-11 13:42:35 +00:00
'expiry_date_document',
2020-06-01 18:31:25 +00:00
'createdAt'
];
protected $fillable = [
'firstname',
'lastname',
'birth_date',
'town',
2020-06-11 13:42:35 +00:00
'country',
2020-06-01 18:31:25 +00:00
'identity_document',
'id_identity_document',
2020-06-11 13:42:35 +00:00
'expiry_date_document',
'id_user',
2020-06-01 18:31:25 +00:00
'status',
'createdAt',
'user_image',
2020-06-11 13:42:35 +00:00
'document_image',
'user_code',
'idNetwork'
2020-06-01 18:31:25 +00:00
];
public function user()
{
return $this->belongsTo(User::class, 'idUser');
}
2020-06-11 13:42:35 +00:00
public function network()
{
return $this->belongsTo(Network::class, 'idNetwork');
}
public function rules()
{
return [
'lastname'=>'required',
'birth_date'=> 'required|date|before_or_equal:today',
'town'=>'required',
'country'=> 'required',
'identity_document'=> 'required',
'id_identity_document'=> 'required',
'expiry_date_document'=>'required|date|after_or_equal:today',
'id_user' => 'required|integer|min:0|not_in:0'
];
}
2020-06-01 18:31:25 +00:00
}