Added more filtering for appeal check

Appeal checks needed an emptry string filter so all requested data is
accounted for and not left emptyAdded more filtering for appeal check
This commit is contained in:
ro 2024-02-09 15:12:04 -06:00
parent da0ddb3ef0
commit 9e7c7c584e

View file

@ -30,19 +30,28 @@ class AppealController extends Controller
'error' => 'Appeal already in process for Location', 'error' => 'Appeal already in process for Location',
]); ]);
} else { } else {
//TODO: Add empty string filtering and check if location exists in DB if (
$new = Appeal::create([ empty($request->location)
'uuid' => Uuid::uuid4(), || empty($request->location_admin)
'location' => $request->location, || empty($request->sponsor)
'location_admin' => $request->location_admin, || empty($request->appeal_description)
'sponsor' => $request->sponsor, ) {
'description' => $request->appeal_description, return back()->withErrors([
'approved' => false, 'error' => 'All fields are required',
'reviewed' => false, ]);
]); } else {
Mail::to(env('TBS_ADMIN_EMAIL'))->send(new LocationAppeal($request->location, $request->sponsor)); $new = Appeal::create([
'uuid' => Uuid::uuid4(),
'location' => $request->location,
'location_admin' => $request->location_admin,
'sponsor' => $request->sponsor,
'description' => $request->appeal_description,
'approved' => false,
'reviewed' => false,
]);
Mail::to(env('TBS_ADMIN_EMAIL'))->send(new LocationAppeal($request->location, $request->sponsor));
}
} }
//return redirect('/appeals'); //return redirect('/appeals');
return back()->with('message', "Appeal Filed"); return back()->with('message', "Appeal Filed");
}; };