public function getIndex() { $builds = Build::where('is_published', '=', '1')->orderBy('updated_at', 'desc')->take(5)->get(); $modversions = Modversion::whereNotNull('md5')->orderBy('updated_at', 'desc')->take(5)->get(); $rawChangeLog = UpdateUtils::getLatestChangeLog(); $changelogJson = array_key_exists('error', $rawChangeLog) ? $rawChangeLog : array_slice($rawChangeLog, 0, 10); return View::make('dashboard.index')->with('modversions', $modversions)->with('builds', $builds)->with('changelog', $changelogJson); }
public function getUpdateCheck() { if (Request::ajax()) { if (UpdateUtils::getUpdateCheck()) { Cache::put('update', true, 60); return Response::json(array('status' => 'success', 'update' => true)); } else { if (Cache::get('update')) { Cache::forget('update'); } return Response::json(array('status' => 'success', 'update' => false)); } } return Response::view('errors.missing', array(), 404); }
public function postLogin() { $email = Input::get('email'); $password = Input::get('password'); $remember = Input::get('remember') ? true : false; $credentials = array('email' => $email, 'password' => $password); if (Auth::attempt($credentials, $remember)) { Auth::user()->last_ip = Request::ip(); Auth::user()->save(); //Check for update on login if (UpdateUtils::getUpdateCheck()) { Cache::put('update', true, 60); } return Redirect::to('dashboard/'); } else { return Redirect::to('login')->with('login_failed', "Invalid Username/Password"); } }
public static function init() { self::$githubclient = new \Github\Client(new \Github\HttpClient\CachedHttpClient(array('cache_dir' => storage_path() . '/github-api-cache'))); }