1

I am creating an event based website. I am using laravel for this with backbone. I am retrieving data from database using backbonejs with laravel as following

var events = new Events();
new EventsView({el: $("#calendar"), collection: events}).render();
events.fetch();

On the server side I have following controller

class Calendars_Controller extends Base_Controller {

public $restful = true;

public function get_index()
{
    //print_r(Calendar::all() );
    return Calendar::all();
}

}

But this returns following error

Unhandled Exception

Message:

Array to string conversion
Location:

/Applications/MAMP/htdocs/calendar/laravel/response.php on line 272

How can I solve this issue?

1 Answer 1

1

If you're not using Laravel 4, you might want to try returning the following from your controller instead:

$events = Calendar::all();
return Response::eloquent($events);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.