<?php namespace App\Http\Controllers; use Illuminate\Support\Facades\{DB,Cache}; class ProductionHealthController extends Controller {public function __invoke(){try{DB::select('select 1');$db=true;}catch(\Throwable){$db=false;}try{Cache::put('healthcheck','ok',10);$cache=Cache::get('healthcheck')==='ok';}catch(\Throwable){$cache=false;}return response()->json(['app'=>'ok','database'=>$db?'ok':'failed','cache'=>$cache?'ok':'failed','queue'=>config('queue.default'),'environment'=>app()->environment()],($db&&$cache)?200:503);}}