在我的Laravel路线文件(web.php)中,我有以下路线。
Route::resource('notifications/{section_id}', 'NotificationController', ['as' => 'notifications']);
然后我有一个刀片模板打开一个这样的表格
{!! Form::model($qList,['route' => ['notifications.store']]) !!}
但是,此行会生成错误Route [notifications.store] not defined.
正在运行php artisan route:list
我可以看到路由名称为notifications.{section_id}.store
。即{section_id}
包含在路线名称中。这是我的问题吗?参数似乎没有出现在我的任何其他路线中,而且我的NotificationController中有store
方法
由于
答案 0 :(得分:0)
这样写,编写完整的路由名称并在路由数组中传递section_id参数:
@word <= Remove @
word <= Remove @
=word <= Remove =
word <= Remove =
@=word <= Remove @ AND =
=word <= Remove @ AND =
word <= Remove @ AND =
=@word <= Remove = AND @
@word <= Remove = AND @
word <= Remove = AND @
=@==@=@=@@word <= Remove all the = and @
@==@=@=@@word <= Remove all the = and @
==@=@=@@word <= Remove all the = and @
=@=@=@@word <= Remove all the = and @
@=@=@@word <= Remove all the = and @
=@=@@word <= Remove all the = and @
@=@@word <= Remove all the = and @
=@@word <= Remove all the = and @
@@word <= Remove all the = and @
@word <= Remove all the = and @
word <= Remove all the = and @
然后,表单提交网址将成为(假设99为您的部分ID)
Form::model($qList,['route' => ['notifications.{section_id}.store', $section_id]])
此外,您可以选择使用&#39;名称强制在RESTful路线上强制路由名称。参数,像这样:
<form method="POST" action="http://laravel5.dev/notifications/99" accept-charset="UTF-8"><input name="_token" type="hidden" value="...">
然后,Route::resource('notifications/{section_id}', 'TestController', ['as' => 'notifications', 'names' => ['store' => 'notifications.store']]);
您会看到
php artisan route:list