Files
maher 511fad8199
Build / run (push) Has been cancelled
Initial commit
2026-05-14 13:42:10 +02:00

56 lines
1.1 KiB
PHP
Executable File

<?php
namespace Common\Files;
use App\Models\User;
use Common\Auth\BaseUser;
class FileEntryUser extends BaseUser
{
protected $table = 'users';
protected bool $billingEnabled = false;
public function getMorphClass()
{
return User::MODEL_TYPE;
}
protected $hidden = [
'password',
'remember_token',
'first_name',
'last_name',
'has_password',
'pivot',
];
protected $appends = ['owns_entry', 'entry_permissions', 'display_name'];
public function getOwnsEntryAttribute()
{
return $this->pivot->owner;
}
public function getEntryPermissionsAttribute()
{
if ($this->pivot->owner) {
return [
'edit' => true,
'view' => true,
'download' => true,
];
}
return $this->pivot->permissions;
}
public function toArray(bool $showAll = false): array
{
return array_merge(
$this->attributesToArray(),
$this->relationsToArray(),
);
}
}