<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class userLogHistory
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
   
    public function handle(Request $request, Closure $next)
    {
        $user_os = $_SERVER['HTTP_USER_AGENT'];

        
        DB::table('user_log_details')->insert([
            'last_ip' => $request->ip(),
            'email' => $request->email,
            'device_info' => $user_os,
            'created_at' => now()
        ]);



        return $next($request);
    }
}
