Welcome Guest, Not a member yet? Register   Sign In
Problem with redirect-> to
#1

(This post was last modified: 07-03-2020, 11:22 PM by hugoafr.)

Hello,
sorry for my English,
I have a strange problem, redirection works fine when I call it from a method, but when I call it from a function it doesn't work.

Example:

PHP Code:
   //Example function to redirect
    public function _redirect_user(){
        return redirect()->to(site_url('proyecto/index'));
    }
    
    
//This does not work, it does not throw an error, it is just as if the process ended.
    public function my_method_a()    
    
{
        $this->_redirect_user();
    }
    
    
//This works fine.
    public function my_method_b()    
    
{
        return redirect()->to(site_url('proyecto/index'));
    
Reply
#2

(This post was last modified: 07-04-2020, 01:42 AM by inumaru.)

Try to return in your my_method_a() function.

PHP Code:
return $this->_redirect_user(); 
Reply
#3

(07-04-2020, 01:39 AM)inumaru Wrote: Try to return in your my_method_a() function.

PHP Code:
return $this->_redirect_user(); 

Funcionó de esa forma, muchas gracias amigo.

It worked that way, thank you very much friend.

Big Grin
Reply




Theme © iAndrew 2016 - Forum software by © MyBB