| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- declare(strict_types=1);
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- class DocumentationFolderPermission extends Model
- {
- public const SUBJECT_ALL = 'all';
- public const SUBJECT_ROLE = 'role';
- public const SUBJECT_USER = 'user';
- protected $fillable = [
- 'folder_id',
- 'subject_type',
- 'role_id',
- 'user_id',
- 'can_read',
- 'can_write',
- ];
- protected function casts(): array
- {
- return [
- 'can_read' => 'boolean',
- 'can_write' => 'boolean',
- ];
- }
- public function folder(): BelongsTo
- {
- return $this->belongsTo(DocumentationFolder::class, 'folder_id');
- }
- public function role(): BelongsTo
- {
- return $this->belongsTo(Role::class);
- }
- public function user(): BelongsTo
- {
- return $this->belongsTo(User::class);
- }
- }
|