peterguo 2 месяцев назад
Родитель
Сommit
b9c6b44e16
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      app/Models/File.php

+ 5 - 0
app/Models/File.php

@@ -66,6 +66,11 @@ class File extends Model
         return $this->belongsTo(Container::class, 'object_id');
     }
 
+    public function containerLibrary(): HasOneThrough
+    {
+        return $this->hasOneThrough(Library::class, Container::class, 'id', 'id', 'object_id', 'library_id');
+    }
+
     public function library(): HasOneThrough
     {
         return $this->hasOneThrough(Library::class, Container::class, 'id', 'id', 'object_id', 'library_id');