id); return view('yabs.show', compact(['yab'])); } public function destroy(Yabs $yab) { $yabs = Yabs::find($yab->id); $yabs->delete(); if (Server::serverYabsAmount($yab->server_id) === 0) { DB::table('servers') ->where('id', $yab->server_id) ->update(['has_yabs' => 0]); } Cache::forget('all_yabs'); Cache::forget("yabs.{$yab->id}"); return redirect()->route('yabs.index') ->with('success', 'YABs was deleted Successfully.'); } public function chooseYabsCompare() { $all_yabs = Yabs::allYabs(); if (isset($all_yabs[1])){ return view('yabs.choose-compare', compact('all_yabs')); } return redirect()->route('yabs.index') ->with('error', 'You need atleast 2 YABS to do a compare'); } public function compareYabs($yabs1, $yabs2) { $yabs1_data = Yabs::yabs($yabs1); 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); } $yabs2_data = Yabs::yabs($yabs2); 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); } return view('yabs.compare', compact('yabs1_data', 'yabs2_data')); } public function yabsToJson(Yabs $yab): array { $all_yabs = Yabs::yabs($yab->id)[0]; return Yabs::buildYabsArray($all_yabs); } }