Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

try/catch --> much needed

public function sendContactForm(SendContactFormRequest $request)
{
    try {
        $data = [
            'name' => $request->get('name'),
            'email' => $request->get('email'),
            'phone' => $request->get('phone'),
            'message' => $request->get('message'),
        ];
        // SEND EMAIL
        $this->sendNotification($data);

        return redirect()
            ->back()
            ->with('success', trans('web.'));

    } catch (Exception $e) {
        return redirect()
            ->back()
            ->with('danger', $e->getMessage());
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #needed
ADD COMMENT
Topic
Name
9+9 =