Adding the parent folder relationship on a file

parent f53ba1a4
...@@ -45,6 +45,11 @@ class File extends Model implements TaggableInterface ...@@ -45,6 +45,11 @@ class File extends Model implements TaggableInterface
protected $casts = ['is_folder' => 'boolean', ]; protected $casts = ['is_folder' => 'boolean', ];
protected static $entityNamespace = 'asgardcms/media'; protected static $entityNamespace = 'asgardcms/media';
public function parent_folder()
{
return $this->belongsTo(__CLASS__, 'folder_id');
}
public function getPathAttribute($value) public function getPathAttribute($value)
{ {
return new MediaPath($value); return new MediaPath($value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment