コード例 #1
0
 public function redirect($url)
 {
     try {
         $link = URL::where('alt', $url)->first();
         $link->increment('view_count');
         return redirect($link->url);
     } catch (\Exception $e) {
         return json_encode(['error' => 'URL not found.', 'message' => $e->getMessage()]);
     }
 }
コード例 #2
0
 public function view($url)
 {
     $counter = URL::where('count_alt', $url)->first();
     return view('count', compact('counter'));
 }