/** @test */ public function a_setup_can_register_the_first_admin_user() { $setup = new Setup(); $user = new User(); $user->name = "Test User"; $user->email = "*****@*****.**"; $user->password = bcrypt(str_random(10)); $user->role = 5; $setup->registerAdmin($user); $this->seeInDatabase('users', ['email' => "*****@*****.**"]); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $setup = Setup::getStatus()->value; if ($setup == "firstopen" || $setup == "running") { abort(404); } else { return $next($request); } }
public function dashboard() { if (Setup::getStatus()->value == "firstopen") { $info = "You are visiting your dashboard for the first time. Let's configure your website the way you want it."; return View::make('admin.settings', compact('options', 'info')); } else { return View::make('admin.dashboard', compact('options')); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $setup = new Setup(); if ($setup->checkDatabaseConnection() == false) { return View::make('install', ['step' => 'dbcredentials'])->with('conerror', 'Database Connection Failed'); } elseif ($setup->checkDatabaseMigration() == false) { $setup->migrateDatabase(); $setup->setStatus('firstrun'); return View::make('install', ['step' => 'adminregister']); } if ($setup->checkAdminRegistration() == false) { return View::make('install', ['step' => 'adminregister']); } else { return $next($request); } }