2014-12-10 3 views
0

작성된 RESTful 컨트롤러가 있습니다. >Laravel RESTful 컨트롤러 POST 전용으로 리디렉션

/index.php/api/v1 - 나는 그것이 404

/app-container/public/index.php/api/v1에 저를 리디렉션 새로운 자원 (POST)를 만들려고하면 ->

/API/V1 -> 404 여기

제어기 내 경로이다

,369 : 여기
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시에만 리다이렉션됩니다.

답변

1

PUT은 새 리소스를 만들지 않습니다. 기존 자원을 갱신합니다. POST는 새 자원을 작성합니다.

+0

예, "POST"로 작성했습니다. URL로 게시 할 때 리디렉션됩니다. 나는 그 질문을 편집했다. –