/** * Get/Update images */ public function get(Request $request) { $amount = $request->input('amount'); $selector = $request->input('selector'); # Get images log state $fresh = (bool) Log::recentByType('images', '0:12:00')->count(); if ($fresh) { $collect = array(); // Get images from Dropbox $squared = $this->getSquared($collect); $dropbox = $this->getDropbox($collect); // Store and save them $this->storeAndSave($collect); } Log::updateLog('dropbox'); $fields = array('tid', 'content'); $squared = Dbox::getSquared($fields, $amount)->get(); $content = $this->parseSquared($squared); shuffle($content); return response()->json(['contents' => $content, 'selector' => $selector]); }