Changeset View
Changeset View
Standalone View
Standalone View
src/app/Fs/Permission.php
- This file was added.
<?php | |||||
namespace App\Fs; | |||||
use App\Traits\UuidStrKeyTrait; | |||||
use Illuminate\Database\Eloquent\Model; | |||||
/** | |||||
* The eloquent definition of a file Permission. | |||||
* | |||||
* @property string $id Permission identifier | |||||
* @property string $file_id File identifier | |||||
* @property int $permissions Access rights | |||||
* @property string $user User identifier (email) | |||||
*/ | |||||
class Permission extends Model | |||||
{ | |||||
use UuidStrKeyTrait; | |||||
public const READ = 1; | |||||
public const WRITE = 2; | |||||
public const DELETE = 4; | |||||
/** @var array<int, string> The attributes that are mass assignable */ | |||||
protected $fillable = [ | |||||
'file_id', | |||||
'permissions', | |||||
'user', | |||||
]; | |||||
/** @var array<string, string> The attributes that should be cast */ | |||||
protected $casts = [ | |||||
'created_at' => 'datetime:Y-m-d H:i:s', | |||||
'updated_at' => 'datetime:Y-m-d H:i:s', | |||||
]; | |||||
/** @var string Database table name */ | |||||
protected $table = 'fs_permissions'; | |||||
/** | |||||
* The file to which this permission belongs. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function file() | |||||
{ | |||||
return $this->belongsTo(File::class, 'file_id', 'id'); | |||||
} | |||||
} |