Why is that my view.blade page instead of displaying the ip adress it displays text: menu_controller ?
in my view blade i call the controller function with this code:
{{ menu_controller::class, 'get_ip'}}
In my menu_controller i got this code in function:
public function get_ip(Request $request)
{
$clientIP = $request->ip();
dd($clientIP);
return 'dd';
}
Can anyone drive me through this logical error i made please ?
@a2v86 not if you try to call the function like this:
{{ menu_controller::class, 'get_ip'}}
Even if that code did work; a controller action is intended to handle a Request, and return a Response; not to arbitrarily fetch some data like this. Why do you not get the data in whatever Controller action you return the view?