82 lines
2.1 KiB
PHP
Executable File
82 lines
2.1 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Account extends Model
|
|
{
|
|
use CrudTrait;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| GLOBAL VARIABLES
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
protected $table = 'accounts';
|
|
// protected $primaryKey = 'id';
|
|
// public $timestamps = false;
|
|
protected $guarded = ['id'];
|
|
protected $fillable = [
|
|
'contacts', 'bank', 'vat', 'country_id', 'legalization_number', 'type',
|
|
];
|
|
protected $casts = [
|
|
'contacts' => 'array',
|
|
'bank' => 'array'
|
|
];
|
|
// protected $hidden = [];
|
|
// protected $dates = [];
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| FUNCTIONS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| RELATIONS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
public function profile()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function country(){
|
|
return $this->belongsTo(Country::class, 'country_id');
|
|
}
|
|
|
|
public function account(){
|
|
return $this->hasMany(Client::class);
|
|
}
|
|
|
|
public function application(){
|
|
return $this->hasOne(Application::class);
|
|
}
|
|
|
|
public function clients(){
|
|
return $this->hasMany(Client::class);
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| SCOPES
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| ACCESSORS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| MUTATORS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
}
|