Example #1
0
 protected function createSiteAndAdminUser()
 {
     $site = new \Veer\Models\Site();
     $site->url = $this->app['config']->get('app.url');
     $site->on_off = 1;
     $site->save();
     $user = new \Veer\Models\User();
     $user->email = '*****@*****.**';
     $user->password = '******';
     $user->sites_id = $site->id;
     $user->save();
     $admin = new \Veer\Models\UserAdmin();
     $admin->save();
     $user->administrator()->save($admin);
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->info('');
     $this->info('Veer is starting up...');
     $this->info('');
     //$this->call('veer:publish');
     // Run migrations
     if ($this->option('migrate') == true) {
         $this->info('- Setting up database & tables...');
         $this->call('migrate');
     }
     $this->info('');
     $this->info('- Adding url to sites table...');
     $this->info('');
     $site = new \Veer\Models\Site();
     $site->url = $this->argument('url');
     $site->on_off = 1;
     $site->save();
     // @todo default configuration?
     $this->info('- Registering administrator...');
     $this->info('');
     $email = $this->argument('email') ?: $this->ask('What is your email?');
     $password = $this->argument('password') ?: $this->secret('What is the password?');
     $this->info('');
     $user = new \Veer\Models\User();
     $user->email = $email;
     $user->password = $password;
     $user->sites_id = $site->id;
     $user->save();
     $admin = new \Veer\Models\UserAdmin();
     $admin->save();
     $user->administrator()->save($admin);
     $this->call('cache:clear');
     $this->info('Congratulations. Everything is done.');
     $this->info('Continue here: ');
     $this->info('');
     $this->info($this->argument('url') . '/admin/sites');
     $this->info('');
 }