mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
#591 - monitoring
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\ServerLogFactory;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@ -25,7 +26,7 @@
|
||||
*/
|
||||
class ServerLog extends AbstractModel
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\ServerLogFactory> */
|
||||
/** @use HasFactory<ServerLogFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
@ -103,6 +104,10 @@ public function download(): StreamedResponse
|
||||
return Storage::disk('local')->download($tmpName, str($this->name)->afterLast('/'));
|
||||
}
|
||||
|
||||
if (! Storage::disk($this->disk)->exists($this->name)) {
|
||||
abort(404, "Log file doesn't exist or is empty!");
|
||||
}
|
||||
|
||||
return Storage::disk($this->disk)->download($this->name);
|
||||
}
|
||||
|
||||
@ -114,7 +119,7 @@ public static function getRemote(Builder $query, bool $active = true, ?Site $sit
|
||||
{
|
||||
$query->where('is_remote', $active);
|
||||
|
||||
if ($site instanceof \App\Models\Site) {
|
||||
if ($site instanceof Site) {
|
||||
$query->where('name', 'like', $site->path.'%');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user