| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 
 | public function index(Request $request){
 LinkController::chargeNewCode(10);
 
 $links = Link::
 select('links.code', 'links.link', 'links.updated_at', 'link_infos.clicks')
 ->join('link_infos', 'links.id', '=', 'link_infos.id')
 ->where('links.user_ip', $request->ip())
 ->orderBy('links.id', 'desc')
 ->paginate(10);
 
 $new_link = Link::
 where('id', session('status'))
 ->value('code');
 
 if ($request->ajax()) {
 return view('link.part', [
 'agent' => $agent,
 'links' => $links,
 ]);
 }
 
 return view('index', [
 'agent' => $agent,
 'links' => $links,
 'new_link' => $new_link,
 ]);
 }
 
 |