Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Laravel - ish question.

Hello,

So I am building a website with laravel 5.1 and I have already built the front end. I used AdminLTE template for the admin panel and I want to use a chart to show the site views over the last months. AdminLTE uses morris.js (http://morrisjs.github.io/morris.js/) for the charts and as shown in the documentation the data is saved as an array of objects like this:

data: [
                { year: '2008', value: 100},
                { year: '2009', value: 10 },
                { year: '2010', value: 5 },
                { year: '2011', value: 5 },
                { year: '2012', value: 20 }
            ],

I want to adapt this for site visits but thay are saved in a database. So my question is should I use the controller and return them with the view and then echo that data in the array or should I make an AJAX request.