Exemplo n.º 1
0
 /** @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' => "*****@*****.**"]);
 }
Exemplo n.º 2
0
 /**
  * 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);
     }
 }
Exemplo n.º 3
0
 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'));
     }
 }
Exemplo n.º 4
0
 /**
  * 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);
     }
 }