Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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]);
 }
Exemplo n.º 3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $linksObj = Links::all();
     return view('links.index', compact('linksObj'));
 }
Exemplo n.º 4
0
 public function listLink()
 {
     $links = Links::all();
     //var_dump($links);die;
     return view('link/listLink')->with('links', $links);
 }
Exemplo n.º 5
0
 public function listLink()
 {
     //$links = Links::paginate(3);
     $links = Links::all(['name', 'slug']);
     return view('link/listLink')->with('links', $links);
 }