anonymox
2254
3
Requests

How to get client ip address in register controller in laravel 5.3 with passport enabled

Posted 2 years ago by anonymox

Hi i want to get the client ip address in my laravel project when registering, I've found some solutions that says get the ip using request global function like :

Protected function create(array $data, Request $request){
Return user::create([
'name' => $data['name'],
'ip' => $request->ip();
]);
}

But because I'm using passport in my project and it added guzzel to the project when i add :

Use Illuminate\Http\Request; 

To my register controller it gives me an error message of conflict with guzzel Request.

How can i solve this?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.