Changeset View
Changeset View
Standalone View
Standalone View
src/app/FilePermission.php
- This file was added.
<?php | |||||
namespace App; | |||||
use Illuminate\Database\Eloquent\Model; | |||||
/** | |||||
* The eloquent definition of a FilePermission. | |||||
* | |||||
* @property int $id | |||||
* @property string $file_id | |||||
* @property int $permissions | |||||
* @property string $user | |||||
*/ | |||||
class FilePermission extends Model | |||||
{ | |||||
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', | |||||
]; | |||||
/** | |||||
* The file to which this permission belongs. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function file() | |||||
{ | |||||
return $this->belongsTo(File::class, 'file_id', 'id'); | |||||
} | |||||
} |