Laravel 4.2 REST Controller returns 'Class Not Loaded' along with response

102 Views Asked by At

I'm making a REST call to an API I have set up in Laravel 4.2. This is a GET call, and the URL of the call is /api/v1/setup

My Route setup in Laravel is:

Route::group(array('prefix' => 'api/v1', 'after' => 'allowOrigin'), function() {
    Route::resource('setup', 'SetupController', array('only' => array('index')));
});

I have SetupController.php in the app folder, and the code looks like this:

class SetupController extends \BaseController {

    public function index()
    {
        $code       = 200;
        $response   = array(
            'landing_page_id'       => 309,
            'landing_page_version'  => 1,
            'unit_cost'             => 18,
            'content'               => 'Headline Goes Here'
        );

        return Response::json($response, $code);
    }
}

But when I call this resource via Postman, or even via the page itself, I get the following response every time:

Class not loaded: SetupController{"landing_page_id":309,"landing_page_version":1,"unit_cost":18,"content":"Headline Goes Here"}

So it is apparently executing the code and returning the values, but prefacing it with 'Class Not Loaded: SetupController.'

Any thoughts? I've looked all over and have not found any reference to this 'Class Not Loaded' message being returned anywhere.

0

There are 0 best solutions below