I have the following in my routes.php:
Route::get('/displayphotos', function()
{
return view('displayphotos')->with('photos', photo::all());
});
I basically have a javascript code section which initially uses the $photos that the displayphotos routes returns using photo::all()... This does work and everything. I have this running on a 10000 interval.
setInterval(function() {
_.forEach({!! $photos !!}, function(value, key) {
photos_array.push(value.name);
});
photos_array = _.uniq(photos_array);
More code here...
}, 10000);
So essentially what I want to accomplish is having that $photos get refreshed in here when the interval kicks in it would grab the latest values from $photos which is stored in the database. I am assuming this means I need to make an ajax request somehow using GET? Would I need to add a controller method for this? or can it be done inline somehow?
Can anyone help with how I would accomplish what I am asking?