1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 23:42:32 +01:00

Update YabsController return formatting & compare data check

Update YabsController return formatting
Update for an is null check on data calling
This commit is contained in:
cp6 2022-11-05 12:48:07 +11:00
parent 34a12e6ffd
commit 997b07a0b7

View File

@ -12,8 +12,7 @@ class YabsController extends Controller
{ {
public function index() public function index()
{ {
$yabs = Yabs::allYabs(); return view('yabs.index', ['yabs' => Yabs::allYabs()]);
return view('yabs.index', compact(['yabs']));
} }
public function create() public function create()
@ -28,8 +27,7 @@ class YabsController extends Controller
public function show(Yabs $yab) public function show(Yabs $yab)
{ {
$yab = Yabs::yabs($yab->id); return view('yabs.show', ['yabs' => Yabs::yabs($yab->id)]);
return view('yabs.show', compact(['yab']));
} }
public function destroy(Yabs $yab) public function destroy(Yabs $yab)
@ -66,13 +64,13 @@ class YabsController extends Controller
{ {
$yabs1_data = Yabs::yabs($yabs1); $yabs1_data = Yabs::yabs($yabs1);
if (count($yabs1_data) === 0) { if (is_null($yabs1_data)) {
abort(404); abort(404);
} }
$yabs2_data = Yabs::yabs($yabs2); $yabs2_data = Yabs::yabs($yabs2);
if (count($yabs2_data) === 0) { if (is_null($yabs2_data)) {
abort(404); abort(404);
} }