#591 - monitoring

This commit is contained in:
Saeed Vaziry
2025-05-31 00:18:04 +02:00
parent 857319025f
commit c09c7a63fa
32 changed files with 1692 additions and 117 deletions

View File

@ -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.'%');
}