first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

55
common/Files/FileEntryUser.php Executable file
View File

@@ -0,0 +1,55 @@
<?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(),
);
}
}