You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
502 B
30 lines
502 B
<?php
|
|
|
|
|
|
namespace App\Documents;
|
|
|
|
|
|
trait BaseDocument
|
|
{
|
|
|
|
public function getAppend()
|
|
{
|
|
return array_merge($this->appends, ['id']);
|
|
}
|
|
|
|
public function getHidden()
|
|
{
|
|
return array_merge($this->hidden, ['_id']);
|
|
}
|
|
|
|
public function setIdAttribute($value)
|
|
{
|
|
$this->attributes['_id'] = $value;
|
|
}
|
|
|
|
public function scopeWithoutTrash($q)
|
|
{
|
|
return $q->where(fn ($q) => $q->where('deleted_at', null)->orWhere('deleted_at', ''));
|
|
}
|
|
|
|
}
|