public static function getSolutionDependencies($solution_id) { $cache_name = __METHOD__ . '_solution_id=' . $solution_id; $solutions = Cache::remember($cache_name, Config::get('constants.CACHE_TIME_DAY'), function () use($solution_id, $cache_name) { if (App::environment('local')) { Log::debug('Cache: ' . $cache_name); } return DB::table('solutions')->join('users', 'solutions.user_id', '=', 'users.id')->where('solutions.id', $solution_id)->where('solutions.deleted', false)->select(array('users.id', 'solutions.id', 'users.name AS user_name', 'solutions.created_at'))->get(); }); Solution::resolveSolutionsFiles($solutions); return $solutions; }
public function solutions() { $user_id = Auth::user()->id; $solutions = DB::table('solutions')->join('tasks', 'solutions.task_id', '=', 'tasks.id')->where('solutions.user_id', $user_id)->where('solutions.deleted', false)->where('tasks.deleted', false)->orderBy('solutions.created_at', 'desc')->select('solutions.*', 'tasks.name AS task_name')->paginate(15); Solution::resolveSolutionsFiles($solutions); return view('user/solutions', ['solutions' => $solutions]); }