【发布时间】:2015-02-08 19:54:52
【问题描述】:
我创建了一个 RESTful 控制器。当我尝试创建新资源 (POST) 时,它会将我重定向到 404。
/app-container/public/index.php/api/v1 ->
/index.php/api/v1 ->
/api/v1 -> 404
这是我的控制器路线:
Route::resource('restauranthours', 'restaurantHoursController');
这是我的控制器:
class restaurantHoursController extends \BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
return "Create";
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
return "Store";
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
$day = $_GET['day'];
return Response::json(DB::select('select * from restaurantHours where restId=? and day=? order by day',array($id, $day)));
}
/**
* 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)
{
//
return "Update";
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
} }
如果我使用 GET 或 PUT,它会给我显示的值。它只在 POST 上重定向。
【问题讨论】: