/** * Display a listing of the resource. * * @param Illuminate\Http\Request $request * @return Response */ public function indexOrder(Request $request) { $statut = $this->user_gestion->getStatut(); $posts = $this->blog_gestion->index(10, $statut == 'admin' ? null : $request->user()->id, $request->input('name'), $request->input('sens')); $links = str_replace('/?', '?', $posts->render()); return response()->json(['view' => view('back.blog.table', compact('statut', 'posts'))->render(), 'links' => $links]); }
/** * Display a listing of the resource. * * @param Illuminate\Http\Request $request * @return Response */ public function indexOrder(Request $request) { $statut = $this->user_gestion->getStatut(); $posts = $this->blog_gestion->index(10, $statut == 'admin' ? null : $request->user()->id, $request->name, $request->sens); $links = $posts->appends(['name' => $request->name, 'sens' => $request->sens]); if ($request->ajax()) { return response()->json(['view' => view('back.blog.table', compact('statut', 'posts'))->render(), 'links' => $links->setPath('order')->render()]); } $links->setPath('')->render(); $order = (object) ['name' => $request->name, 'sens' => 'sort-' . $request->sens]; return view('back.blog.index', compact('posts', 'links', 'order')); }