public function testimony() { // $titles = 'Testimonial'; $limit = 20; $testimonials = \App\Testimony::where('status', 1)->orderBy('created_at', 'desc')->paginate($limit); if (\Input::get('page') > 1) { $html = ''; foreach ($testimonials as $testimony) { $html .= '<div class="well"> <h4>' . $testimony->title . '</h4> <p>' . $testimony->content . '</p> <small>--' . $testimony->customer->firstname . ' ' . $testimony->customer->lastname . '</small> </div>'; } $html .= '<a class="jscroll-next hidden" href="' . $testimonials->nextPageUrl() . '">next page</a>'; return $html; } else { return view('pages.testimony', compact('titles', 'testimonials')); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $testimony = Testimony::find($id); $testimony->delete(); return response()->json(array('status' => 200, 'monolog' => array('title' => 'delete success', 'message' => 'object has been deleted'), 'id' => $id)); }
public function testimonials(Request $request) { // if ($request->action == 'create') { return view('admin.pages.testimony.create'); } if ($request->action == 'edit' && isset($request->id)) { $testimony = \App\Testimony::find($request->id); return view('admin.pages.testimony.edit', compact('testimony')); } $request = json_encode($request->all()); $request = json_decode($request, true); $api_url = route('api.testimony.index', $request); return view('admin.pages.testimony.listing', compact('api_url')); }