我正在尝试使用app/routes.php中的以下内容路由到RESTful控制器:
Route::controller('register', 'RegisterController');
Route::get('/', 'HomeController@showWelcome');
Run Code Online (Sandbox Code Playgroud)
在我的app/controllers/RegisterController.php文件中,我添加了以下内容:
<?php
class RegisterController extends BaseController
{
public function getRegister()
{
return View::make('registration');
}
public function postRegister()
{
$data = Input::all();
$rules = array(
'first_name' => array('alpha', 'min:3'),
'last_name' => array('alpha', 'min:3'),
'company_name' => array('alpha_num'),
'phone_number' => 'regex:[0-9()\-]'
);
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
return 'Data was saved.';
}
return Redirect::to('register')->withErrors($validator);
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
当我在终端运行php artisan路线时,我得到:
+--------+--------------------------------------------------+------+----------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters | …Run Code Online (Sandbox Code Playgroud)