解决方法:已经定义的“路由名称未定义”

时间:2019-09-27 02:54:44

标签: php html css laravel

我已经定义了路由,但一直给我路由未定义错误

web.php
[1]: https://imgur.com/e78VIqV.jpg "tooltip"

EventController
[2]: https://imgur.com/NAXSUkQ.jpg "tooltip"

view
[3]: https://imgur.com/b5ROHcv.jpg "tooltip"

error
[4]: https://imgur.com/A4lcu0R.jpg "tooltip"

2 个答案:

答案 0 :(得分:0)

event.edit已存在于resource('event')

Route::resource('event','eventcontroller');

Verb          Path                         Action  Route Name
GET           /event                       index   event.index
GET           /event/create                create  event.create
POST          /event                       store   event.store
GET           /event/{event}               show    event.show
GET           /event/{event}/edit          edit    event.edit
PUT|PATCH     /event/{event}               update  event.update
DELETE        /event/{event}               destroy event.destroy

您的event.edit已添加到资源中。因此,如果您要使用呼叫编辑方法,则可以直接使用它,也可以对其进行更改。

更改

->name('event.edit');

TO

->name('event.sched.edit');


Route::get('/sched/edit/{id},'Eventcontroller@update')->name('event.sched.edit');

答案 1 :(得分:-2)

我认为这就是答案

 <cfscript>
 endpoint = "https://translation.googleapis.com/language/translate/v2";

 if (cgi.request_method == "POST")  {
     httpService = new http();
     httpService.setMethod("post");
     httpService.setCharset("utf-8");
     httpService.setUrl(endpoint);
     httpService.addParam(type="formfield", name="q", value= form.emergency_procedures);
     httpService.addParam(type="formfield",name="target",value="yourlanguage");
     httpService.addParam(type="formfield",name="key",value="yourkey");

     result = httpService.send().getPrefix();
     writedump(result); 
     }
 </cfscript>