turtle-wow-source-kinda/Dumps/Source Code/8 - Development_website/develop/app/Models/auth/Uptime.php

31 lines
687 B
PHP
Raw Normal View History

2024-08-06 16:06:40 +00:00
<?php
namespace App\Models\auth;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Uptime extends Model
{
use HasFactory;
protected $connection = 'mysql2';
protected $table = 'uptime';
public function getUptime()
{
$days = floor($this->uptime / (60 * 60 * 24));
$hours = floor(($this->uptime % (60 * 60 * 24)) / (60 * 60));
$minutes = floor(($this->uptime % (60 * 60)) / 60);
$seconds = $this->uptime % 60;
return array(
'days' => $days,
'hours' => $hours,
'minutes' => $minutes,
'seconds' => $seconds
);
}
}