library items parent_id

This commit is contained in:
Benjamin Takats
2023-01-19 14:59:29 +01:00
parent b1073919df
commit d1d98b6c31
7 changed files with 77 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Library extends Model
{
@@ -44,4 +45,9 @@ class Library extends Model
{
return $this->belongsToMany(LibraryItem::class);
}
public function parent() : BelongsTo
{
return $this->belongsTo(__CLASS__, 'parent_id');
}
}