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