2
我想只保護POST請求到我的索引,我該怎麼做?保護特定的請求類型,寧靜的API,Laravel
public $restful = true;
public function __construct()
{
parent::__construct();
//this does not work
$this->filter('before', 'auth')->only(array('post_index'));
}
public function get_index()
{
//I do not want to protect this
return Response::eloquent(Model::all());
}
public function post_index()
{
//I want to protect only this call
}
太棒了!謝謝! – 2013-02-14 00:51:18