public function handle($request, Closure $next) { $guest = new Guest(); $ip = $request->ip(); $check_guest = Guest::where('ip_address', $ip)->count(); if ($check_guest == 0) { $guest->ip_address = $ip; $guest->save(); } return $next($request); //return var_dump($check_guest); }
public function __construct() { $this->middleware('admin'); $this->data['guest'] = Guest::all()->count(); }