80 lines
2.3 KiB
PHP
Executable File
80 lines
2.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
|
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
|
|
class Document extends Model
|
|
{
|
|
use CrudTrait;
|
|
use HasTranslations;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| GLOBAL VARIABLES
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
protected $table = 'documents';
|
|
// protected $primaryKey = 'id';
|
|
// public $timestamps = false;
|
|
// protected $guarded = ['id'];
|
|
protected $fillable = [
|
|
'name',
|
|
'description',
|
|
'max_size',
|
|
'business',
|
|
'company',
|
|
'all_country',
|
|
'order'
|
|
];
|
|
// protected $hidden = [];
|
|
// protected $dates = [];
|
|
protected $translatable = ['name', 'description'];
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| FUNCTIONS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| RELATIONS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
public function attachments(): BelongsToMany{
|
|
return $this->belongsToMany(Attachment::class);
|
|
}
|
|
|
|
public function groups(): BelongsToMany{
|
|
return $this->belongsToMany(Documentgroup::class,'documentgroup_documents');
|
|
}
|
|
|
|
public function countries(): BelongsToMany{
|
|
return $this->belongsToMany(Country::class,'document_countries', 'document_id', 'country_id');
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| SCOPES
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| ACCESSORS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| MUTATORS
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
}
|