/** * Remove the specified resource from storage. * * @param type $id * @param Emails $email * * @return type Redirect */ public function destroy($id, Emails $email) { try { // fetching the database instance of the current email $emails = $email->whereId($id)->first(); // checking if deleting the email is success or if it's carrying any dependencies if ($emails->delete() == true) { return redirect('emails')->with('success', 'Email Deleted sucessfully'); } else { return redirect('emails')->with('fails', 'Email can not Delete '); } } catch (Exception $e) { // returns if the try fails return redirect()->back()->with('fails', $e->getMessage()); } }