我有一个REST控制器,我使用新动作verify()
进行了扩展。现在我想通过命名路由调用此操作,但是当我打开 www.foo.bar/verify 时出现错误:
BadMethodCallException in Controller.php line 273:
Method [verify] does not exist.
当我在routes.php中调用动作create
时,它的作用令人惊讶......这有点奇怪,我现在已经粘贴了我的错误......
如何使用名称路径调用我的verify()操作?
Route::get('/', 'WelcomeController@index');
Route::resource( 'activation', 'ActivationController' );
Route::get( 'verify', [ 'as' => 'verify', 'uses' => 'ActivationController@verify' ]); // throws an error
// Route::get( 'verify', [ 'as' => 'verify', 'uses' => 'ActivationController@create' ]); // this works ?!?
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ActivationController extends Controller {
// ....
public function verfiy( ) {
return "verify";
}
public function create()
{
return "create";
}
// ...
答案 0 :(得分:0)
你拼错了这个功能。 :)
public function verfiy( ) {
^^