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