/** * Show all URLs * @return Response */ public function showAll(Request $request) { $links = Links::all(); foreach ($links as $link) { $link['short_url'] = stripslashes(env('BASE_URL') . "/" . $link->code); } $result = $this->getResult(self::SUCCESS, self::OK, ['links' => $links]); return response()->json($result, self::OK); }
/** * Display a listing of the links. * * @param Request $request * @return Response */ public function index(Request $request) { $links = Links::all(); $sorted = $links->sort(function ($a, $b) { if ($a->decayed() == $b->decayed()) { return 0; } return $a->decayed() > $b->decayed() ? -1 : 1; }); return view('link.index', ['links' => $sorted]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $linksObj = Links::all(); return view('links.index', compact('linksObj')); }
public function listLink() { $links = Links::all(); //var_dump($links);die; return view('link/listLink')->with('links', $links); }
public function listLink() { //$links = Links::paginate(3); $links = Links::all(['name', 'slug']); return view('link/listLink')->with('links', $links); }