class Document extends Model
{
use HasFactory, HasTranslations;
protected $table = 'document';
protected $guarded = [];
public array $translatable = [];
protected $casts = [
'holders' => 'array',
];
protected static function booted(): void
{
static::addGlobalScope(new OrganizationScope);
}
public function organization(): BelongsTo
{
return $this->belongsTo(Organization::class)->where(['is_master' => 0]);
}
public function documentBase(): BelongsTo
{
return $this->belongsTo(DocumentBase::class)->where(['is_active' => 1]);
}
public function holder(): BelongsTo
{
return $this->belongsTo(Holder::class);
}
}
class Document extends Model
{
use HasFactory, HasTranslations;
protected $table = 'document';
protected $guarded = [];
public array $translatable = [];
protected $casts = [
'holders' => 'array',
];
protected static function booted(): void
{
static::addGlobalScope(new OrganizationScope);
}
public function organization(): BelongsTo
{
return $this->belongsTo(Organization::class)->where(['is_master' => 0]);
}
public function documentBase(): BelongsTo
{
return $this->belongsTo(DocumentBase::class)->where(['is_active' => 1]);
}
public function holder(): BelongsTo
{
return $this->belongsTo(Holder::class);
}
}