【发布时间】:2017-06-15 07:59:54
【问题描述】:
我收到以下错误:UrlGenerator.php 第 605 行中的 ErrorException: Action App\Http\Controllers\VehicleController@processLead not defined。
我已经使用command php artisan route:list 检查了路由是否存在,确实存在。
路由\web.php
<?php
use App\Http\Controllers\BaseController;
use App\Http\Controllers\VehicleController;
use App\Http\Requests\ValidateLeadValues;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::get('/', 'IndexController@index');
Route::get('usedcars/', 'VehicleController@index');
Route::post('processLead/{id}', function ($id, ValidateLeadValues $leadValues, VehicleController $vehicleController)
{
return $vehicleController->processLead($id, $leadValues);
})->where(['id' => '[0-9]+']);
我的视图文件中有以下内容。该代码在我的表单操作中,当我删除它时,页面加载正常。
{{ action('VehicleController@processLead', ['id' => $vehicle->id]) }}
【问题讨论】:
-
你更新什么了吗?也许你在不同的库上有错误的版本。
-
是的,我更新了作曲家。更新前一切正常,现在我收到此错误。
标签: php routes laravel-5.3