peterguo 2 月之前
父節點
當前提交
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');