Download app/Http/Controllers/Common/HealthController.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Common/HealthController.php
- Command line
-
hf download hf://pnacorp/magicai/app/Http/Controllers/Common/HealthController.php
-
curl -L -o HealthController.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Common/HealthController.php
1.12 kB
| namespace App\Http\Controllers\Common; | |
| use App\Http\Controllers\Controller; | |
| use Carbon\Carbon; | |
| use Illuminate\Support\Facades\App; | |
| use Illuminate\Support\Facades\Artisan; | |
| use Spatie\Health\Commands\RunHealthChecksCommand; | |
| use Spatie\Health\ResultStores\ResultStore; | |
| use Throwable; | |
| class HealthController extends Controller | |
| { | |
| public function index() | |
| { | |
| $resultStore = App::make(ResultStore::class); | |
| $checkResults = $resultStore->latestResults(); | |
| // call new status when visit the page | |
| Artisan::call(RunHealthChecksCommand::class); | |
| return view('panel.admin.health.index', [ | |
| 'lastRanAt' => new Carbon($checkResults?->finishedAt), | |
| 'checkResults' => $checkResults, | |
| ]); | |
| } | |
| public function logs() | |
| { | |
| return view('panel.admin.health.logs'); | |
| } | |
| public function cacheClear() | |
| { | |
| try { | |
| Artisan::call('optimize:clear'); | |
| return response()->json(['success' => true]); | |
| } catch (Throwable $th) { | |
| return response()->json(['success' => false]); | |
| } | |
| } | |
| } | |