public function store(PersonalInfoRequest $request)
{
// 1.validation
try {
// except csrf token from form
$data = request()->except(['_token']);
// convert lower case value to upper case from array
$check = array_map('strtoupper', $data);
// insert all upper case value once in DB
$value = PersonalInformationModel::Insert($check);
DB::commit();
if($value){
$this->JsonData['status'] = 'success';
$this->JsonData['url'] = route('reservation.index');
$this->JsonData['msg'] = 'Succesfully stored Personal details';
}
}
catch(Exception $e) {
$this->JsonData['msg'] = 'Something wen`t wrong on server! Please try again';
$this->JsonData['status'] = $e->getMessage();
DB::rollback();
}
return response()->json($this->JsonData);
}
php artisan make:controller FormIndexController