class HubFile extends Model
{
use HasFactory;
protected $guarded = ['id','created_at','updated_at'];
public functionuser(){return$this->belongsTo(\App\Models\User::class);
}
public functiongetRouteKeyName(){return'name';
}
public functionget_real_url(){return\Storage::disk($this->bucket_name)->url(strtolower($this->visibility).$this->path.$this->name);
}
public functionget_url(){return route('file.link',$this->unique_name);
}
public functionget_path(){return\Storage::disk($this->bucket_name)->path(strtolower($this->visibility).$this->path.$this->name);
}
public functionget_source(){return\Storage::disk($this->bucket_name)->get(strtolower($this->visibility).$this->path.$this->name);
}
public functionget_size(){return\Storage::disk($this->bucket_name)->size(strtolower($this->visibility).$this->path.$this->name);
}
public functiondownload(){return\Storage::disk($this->bucket_name)->download(strtolower($this->visibility).$this->path.$this->name);
}
}