Hello All,
I need help with a explanation on WHY a "return redirect->to()" wont work inside a constructor...
This wont work:
PHP Code:
public function __construct()
{
return redirect()->to('http://www.google.com');
}
public function index()
{
echo 'Hello World!!!!!';
}
This will work:
PHP Code:
public function __construct()
{
}
public function index()
{
return redirect()->to('http://www.google.com');
echo 'Hello World!!!!!';
}
Of course this is only a example and I will have some logic inside the constructor, like: if(NotLogged){ redirect() }
Thank you for the explanation...