Esempio n. 1
0
 /**
  * Remove the contact.
  *
  * @param Model   $contact
  *
  * @return Response
  */
 public function destroy(ContactAdminRequest $request, Contact $contact)
 {
     try {
         $t = $contact->delete();
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('contact::contact.name')]), 'code' => 202, 'redirect' => trans_url('/admin/contact/contact/0')], 202);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/contact/contact/' . $contact->getRouteKey())], 400);
     }
 }
 /**
  * Remove the contact.
  *
  * @param Request $request
  * @param Model   $contact
  *
  * @return json
  */
 public function destroy(ContactAdminApiRequest $request, Contact $contact)
 {
     try {
         $t = $contact->delete();
         return response()->json(['message' => trans('messages.success.delete', ['Module' => trans('contact::contact.name')]), 'code' => 2006])->setStatusCode(202, 'DESTROY_SUCCESS');
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 4006])->setStatusCode(400, 'DESTROY_ERROR');
     }
 }