我收到以下错误:
ReflectionException (-1)
Class PhotosController does not exist
这是我的路线:
Route::resource('photos', ' PhotosController');
当我更改为路由:: get('照片',' PhotosController @ index'); 它工作正常,但使用资源它正在下降?到底是怎么回事? PhotosController:
<?php
class PhotosController extends \BaseController {
/**
* Display a listing of the resource.
* GET /photos
*
* @return Response
*/
public function index()
{
return Photo::all();
}
/**
* Show the form for creating a new resource.
* GET /photos/create
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
* POST /photos
*
* @return Response
*/
public function store()
{
//
}
/**
* Display the specified resource.
* GET /photos/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
* GET /photos/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
* PUT /photos/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}
/**
* Remove the specified resource from storage.
* DELETE /photos/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}
答案 0 :(得分:1)
如果composer dump-autoload
没有修复它,那么它可能是类名或路由文件中的拼写错误,或者在控制器上错误地使用子目录/命名空间。