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:
parent
da0ddb3ef0
commit
9e7c7c584e
1 changed files with 21 additions and 12 deletions
|
@ -30,19 +30,28 @@ class AppealController extends Controller
|
|||
'error' => 'Appeal already in process for Location',
|
||||
]);
|
||||
} else {
|
||||
//TODO: Add empty string filtering and check if location exists in DB
|
||||
$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));
|
||||
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,
|
||||
'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 back()->with('message', "Appeal Filed");
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue