public function transform(\Litecms\Testimonial\Models\Testimonial $testimonial) { return ['id' => $testimonial->getRouteKey(), 'name' => $testimonial->name, 'designation' => $testimonial->designation, 'description' => $testimonial->description, 'image' => $testimonial->image, 'status' => $testimonial->status, 'date' => $testimonial->date]; }
/** * 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); } }
/** * 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 specified resource. * * @param int $id * * @return Response */ public function destroy(TestimonialUserRequest $request, Testimonial $testimonial) { try { $this->repository->delete($testimonial->getRouteKey()); return redirect(trans_url('/user/testimonial/testimonial'))->with('message', trans('messages.success.deleted', ['Module' => trans('testimonial::testimonial.name')]))->with('code', 204); } catch (Exception $e) { redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400); } }