Whenever you put your class in a namespace, any other class that you reference in that class assumes that it is also in that same namespace unless you tell it otherwise.
So, since you set your namespace to Arg\Tagcloud
when you directly reference Request::url()
, PHP thinks that you're telling it to use the Request
class inside the Arg\Tagcloud
namespace.
There's two solutions to this:
Solution 1
Add a \
in front of Request
to tell PHP to use the global namespace, not the Arg\Tagcloud
namespace.
e.g., <a href='".\Request::url()."/myroute/'>
Solution 2
use
the class.
Just add use Request
to the top of your class (under your namespace), this will let PHP know that you want to use this class, but it doesn't belong in the current namespace.
e.g.,
<?php namespace Arg\Tagcloud;
use Request;