1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 15:33:44 +01:00

Added input parameters for compareYabs()

Added input parameters for compareYabs()
Used abort(404) instead of return response()->view('errors.404',........
This commit is contained in:
cp6 2022-10-13 14:21:27 +11:00
parent dcb8a78ff8
commit cde2c8d8b6

View File

@ -4,13 +4,9 @@ namespace App\Http\Controllers;
use App\Models\Server; use App\Models\Server;
use App\Models\Yabs; use App\Models\Yabs;
use App\Process;
use App\Models\DiskSpeed;
use App\Models\NetworkSpeed;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class YabsController extends Controller class YabsController extends Controller
{ {
@ -66,18 +62,18 @@ class YabsController extends Controller
->with('error', 'You need atleast 2 YABS to do a compare'); ->with('error', 'You need atleast 2 YABS to do a compare');
} }
public function compareYabs($yabs1, $yabs2) public function compareYabs(string $yabs1, string $yabs2)
{ {
$yabs1_data = Yabs::yabs($yabs1); $yabs1_data = Yabs::yabs($yabs1);
if (count($yabs1_data) === 0) { if (count($yabs1_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$yabs1'"), 404); abort(404);
} }
$yabs2_data = Yabs::yabs($yabs2); $yabs2_data = Yabs::yabs($yabs2);
if (count($yabs2_data) === 0) { if (count($yabs2_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$server2'"), 404); abort(404);
} }
return view('yabs.compare', compact('yabs1_data', 'yabs2_data')); return view('yabs.compare', compact('yabs1_data', 'yabs2_data'));