first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-04-23 00:14:33 +06:00
commit 356f56eebd
197 changed files with 21536 additions and 0 deletions

43
app/Models/Folder.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Folder extends Model
{
protected $fillable = [
'name',
'parent_id',
'project_id',
'icon',
'color',
'description',
];
public function descendants()
{
return $this->belongsToMany(Folder::class, 'folder_closure', 'ancestor_id', 'descendant_id')
->withPivot('depth');
}
public function documents()
{
return $this->hasMany(Document::class);
}
public function parent()
{
return $this->belongsTo(Folder::class, 'parent_id');
}
public function children()
{
return $this->hasMany(Folder::class, 'parent_id')->with('children');
}
public function project()
{
return $this->belongsTo(Project::class);
}
}