105 lines
2.2 KiB
PHP
105 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Identification
|
|
*
|
|
* @property int $id
|
|
* @property string $firstname
|
|
* @property string $lastname
|
|
* @property Carbon $birth_date
|
|
* @property string $town
|
|
* @property string $country
|
|
* @property string $identity_document
|
|
* @property string $id_identity_document
|
|
* @property Carbon $expiry_date_document
|
|
* @property int $id_user
|
|
* @property int $status
|
|
* @property Carbon $createdAt
|
|
* @property string $user_image
|
|
* @property string $document_image_front
|
|
* @property string $document_image_back
|
|
* @property int $idNetwork
|
|
* @property int $country_id
|
|
*
|
|
* @property User $user
|
|
* @property Network $network
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Identification extends Model
|
|
{
|
|
protected $table = 'identifications';
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'id_user' => 'int',
|
|
'status' => 'int',
|
|
'idNetwork' => 'int',
|
|
'country_id' => 'int'
|
|
];
|
|
|
|
protected $dates = [
|
|
'birth_date',
|
|
'expiry_date_document',
|
|
'createdAt'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'firstname',
|
|
'lastname',
|
|
'birth_date',
|
|
'town',
|
|
'country',
|
|
'identity_document',
|
|
'id_identity_document',
|
|
'expiry_date_document',
|
|
'id_user',
|
|
'status',
|
|
'createdAt',
|
|
'user_image',
|
|
'document_image_front',
|
|
'document_image_back',
|
|
'idNetwork',
|
|
'country_id'
|
|
];
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'id_user');
|
|
}
|
|
|
|
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_without_all:phone_number|integer|min:0|not_in:0',
|
|
'phone_number' => 'required_without_all:id_user'
|
|
];
|
|
}
|
|
}
|