laravel-graphql
laravel-graphql copied to clipboard
How can I get Illuminate\Http\Request instance from query or mutation?
e.g.$request->getClientIp()
I'm doing something like this;
use Illuminate\Http\Request;
class MyQuery extends Query
{
public function __construct(Request $request)
{
var_dump($request->user());die();
}
public function type(){}
public function args(){}
public function resolve($root, $args){}
}
Couldn’t you use the request(); helper?
@kevinvdburgt request() not works
try construct then assign client ip to $this->ip
@onurkose thanks, it works.