walletservice/app/Models/Identification.php

108 lines
2.3 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\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
2021-11-02 16:24:46 +00:00
* @property string $gender
2020-06-01 18:31:25 +00:00
* @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
2020-06-12 06:11:11 +00:00
* @property string $document_image_front
* @property string $document_image_back
2020-06-11 13:42:35 +00:00
* @property int $idNetwork
2020-06-12 06:11:11 +00:00
* @property int $country_id
2020-06-11 13:42:35 +00:00
*
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',
2020-06-12 06:11:11 +00:00
'idNetwork' => 'int',
'country_id' => '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 = [
2021-11-02 16:24:46 +00:00
'firstname',
'lastname',
'birth_date',
'gender',
'town',
'country',
'identity_document',
'id_identity_document',
'expiry_date_document',
'id_user',
'status',
'createdAt',
'user_image',
'document_image_front',
2020-06-12 06:11:11 +00:00
'document_image_back',
'idNetwork',
'country_id'
2020-06-01 18:31:25 +00:00
];
2020-06-12 06:11:11 +00:00
public function country()
{
return $this->belongsTo(Country::class);
}
2020-06-01 18:31:25 +00:00
public function user()
{
2020-06-12 06:11:11 +00:00
return $this->belongsTo(User::class, 'id_user');
2020-06-01 18:31:25 +00:00
}
2020-06-11 13:42:35 +00:00
public function network()
{
return $this->belongsTo(Network::class, 'idNetwork');
}
public function rules()
{
return [
2021-11-02 16:24:46 +00:00
'lastname' => 'required',
'birth_date' => 'required|date|before_or_equal:today',
'gender' => 'required|in:M,F',
'town' => 'required',
'country' => 'required',
'identity_document' => 'required',
'id_identity_document' => 'required',
'expiry_date_document' => 'required|date|after_or_equal:today',
'id_user' => 'required_without_all:phone_number|integer|min:0|not_in:0',
'phone_number' => 'required_without_all:id_user'
2020-06-11 13:42:35 +00:00
];
}
2020-06-01 18:31:25 +00:00
}