在Laravel 5.6的html视图中使用route()和with()

时间:2019-07-11 13:19:20

标签: laravel laravel-5 laravel-routing

对于重定向,在控制器中,我们可以这样写:-

Redirect::Route('front_index')->with('RegError', 'An error occured while adding the user.');

如何设置锚标记的href,以便也可以发送“ RegError”?这样说吧?

<a href="{{route('front_index')->with('RegError', '')}}">

1 个答案:

答案 0 :(得分:2)

实际上您不能这样做,因为with函数用于将参数从控制器传递到视图,并且route助手没有这种方法。 您需要提出请求,并在控制器中通过RegError