Q:

Laravel 5 RESTful resource route not working

I have Laravel 5 resource route:
Route::group(['middleware' => 'auth'], function() {

    Route::resource('api/room', 'RoomsController');

    // ...
});

The RoomsController is generated with php artisan make:controller command.
<?php namespace App\Http\Controllers;
use Auth;
use App\Room;
use App\RoomUsers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class RoomsController extends Controller {
    // ...
}

The index route working. When I GET the api/room, It returns expected result.
There is the RoomsController@index method:
public function index() {
    $user = Auth::user();
    $currentUserRooms = RoomUsers::where('user_id', '=', $user->id)->get();
    return response($currentUserRooms);
}

The problem:
When I try to POST to the same URI (/api/room), I get 500 Internal Server Error.
There is the RoomsController@store method (which should be called when POST request coming).
public function store() {
    return response('is Working') // But isn't working
}

I setted these options in the php.ini file, but I still can't see the error information. It shows only "500 Internal server error"
error_reporting = E_ALL
display_errors = On
display_startup_errors = On

I have enabled the Laravel 5 debug mode too.

A:

The problem was caused by Laravel's CSRF Protection.
I used PostMan to send the requests. It accepts GET requests, but not POST or PUT.
I used the fix from this page to disable CSRF to these routes :
// app/Http/Middleware/VerifyCsrfToken.php
// ...
class VerifyCsrfToken extends BaseVerifier {

    private $openRoutes = ['api/room', 'api/message'];

    public function handle($request, Closure $next) {
        foreach ($this->openRoutes as $route) {
            if ($request->is($route)) {
                return $next($request);
            }
        }

        return parent::handle($request, $next);
    }
}

About the error reporting:
Yesterday I enabled all error reporting options and restarted many times the apache2 service. But no error description or stack trace was showed in PostMan.
Today I wake up and tested it. It just worked. Now I have laravel error reporting with stack trace. I didn't turned off or restart the machine. (Lubuntu 14.04 32bit).
I have no idea why this was happen yesterday. Maybe it was some stupid bug.

