Laravel重定向Trait内部

trait foo{

    public function bar()
    {
         redirect('/'); //not working
    }
}

use Traits;

class DonController extend Controller{
     use Traits\foo;

     $this->bar();
     redirect('/'); //working
}

I'm new in Laravel, I need to create a redirect method inside of trait

However I have problem to do it inside of trait. Anyone know how to solve this?

Only a controller method can return a redirect object to go to another page. You can however invoke the ->send() method of a redirect object to send the redirect directly from anywhere in your application.

trait foo {

    public function bar()
    {
         redirect('/')->send();
    }
}