Mac端末でlaravel 4コントローラーを作成しようとしています
php artisan controller:make UserController
動作し、コントローラーをフォルダーに挿入します。
私のroute.phpに次を追加します:
Route::controller('users', 'UserController');
インデックスの UserController で作成します
return "Hello world"
しかし、localhost/users と入力すると、/users/create にも何も表示されません。
私に何ができる?
トレース エラー:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
open: /Applications/XAMPP/xamppfiles/htdocs/salety/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php
* @param Exception $e
* @return void
*/
protected function handleRoutingException(\Exception $e)
{
if ($e instanceof ResourceNotFoundException)
{
throw new NotFoundHttpException($e->getMessage());
}
ユーザーコントローラー
<?php
class UserController extends \BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return "Hello world!";
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}