Example #1
0
 /**
  * Run the database seeding.
  */
 public function run()
 {
     $defaultSettings = [['name' => 'app_name', 'value' => 'Cachet Demo'], ['name' => 'app_domain', 'value' => 'https://demo.cachethq.io'], ['name' => 'show_support', 'value' => '1'], ['name' => 'app_locale', 'value' => 'en'], ['name' => 'app_timezone', 'value' => 'Europe/London'], ['name' => 'app_track', 'value' => '1'], ['name' => 'app_incident_days', 'value' => '7'], ['name' => 'app_analytics', 'value' => 'UA-58442674-3'], ['name' => 'app_analytics_gs', 'value' => 'GSN-712462-P'], ['name' => 'display_graphs', 'value' => '1']];
     Setting::truncate();
     foreach ($defaultSettings as $setting) {
         Setting::create($setting);
     }
 }
 /**
  * Run the database seeding.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $defaultSettings = [["name" => "app_name", "value" => "Test"], ["name" => "app_domain", "value" => "cachet.dev"], ["name" => "show_support", "value" => "1"]];
     Setting::truncate();
     foreach ($defaultSettings as $setting) {
         Setting::create($setting);
     }
 }
Example #3
0
 /**
  * Handles the actual app setup.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postIndex()
 {
     $postData = Binput::all();
     $v = Validator::make($postData, ['settings.app_name' => 'required', 'settings.app_domain' => 'required', 'settings.show_support' => 'boolean', 'user.username' => 'alpha_dash|required', 'user.email' => 'email|required', 'user.password' => 'required']);
     if ($v->passes()) {
         // Pull the user details out.
         $userDetails = array_pull($postData, 'user');
         // TODO: Do we want to just use Model::unguard() here?
         $user = User::create(['username' => $userDetails['username'], 'email' => $userDetails['email'], 'password' => $userDetails['password'], 'level' => 1]);
         Auth::login($user);
         $settings = array_get($postData, 'settings');
         foreach ($settings as $settingName => $settingValue) {
             Setting::create(['name' => $settingName, 'value' => $settingValue]);
         }
         return Redirect::to('dashboard');
     } else {
         // No good, let's try that again.
         return Redirect::back()->withInput()->with('errors', $v->messages());
     }
 }
Example #4
0
 /**
  * Handles the actual app setup, including user, settings and env.
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
  */
 public function postStep3()
 {
     $postData = Binput::all();
     $v = Validator::make($postData, ['env.cache_driver' => 'required|in:' . implode(',', array_keys($this->cacheDrivers)), 'env.session_driver' => 'required|in:' . implode(',', array_keys($this->cacheDrivers)), 'settings.app_name' => 'required', 'settings.app_domain' => 'required', 'settings.app_timezone' => 'required', 'settings.app_locale' => 'required', 'settings.show_support' => 'boolean', 'user.username' => ['required', 'regex:/\\A(?!.*[:;]-\\))[ -~]+\\z/'], 'user.email' => 'email|required', 'user.password' => 'required']);
     if ($v->passes()) {
         // Pull the user details out.
         $userDetails = array_pull($postData, 'user');
         $user = User::create(['username' => $userDetails['username'], 'email' => $userDetails['email'], 'password' => $userDetails['password'], 'level' => 1]);
         Auth::login($user);
         $settings = array_pull($postData, 'settings');
         foreach ($settings as $settingName => $settingValue) {
             Setting::create(['name' => $settingName, 'value' => $settingValue]);
         }
         $envData = array_pull($postData, 'env');
         // Write the env to the .env file.
         foreach ($envData as $envKey => $envValue) {
             $this->writeEnv($envKey, $envValue);
         }
         Session::flash('setup.done', true);
         if (Request::ajax()) {
             return Response::json(['status' => 1]);
         }
         return Redirect::to('dashboard');
     }
     if (Request::ajax()) {
         return Response::json(['errors' => $v->getMessageBag()], 400);
     }
     return Redirect::back()->withInput()->withErrors($v->getMessageBag());
 }
Example #5
0
 /**
  * Seed the settings table.
  *
  * @return void
  */
 protected function seedSettings()
 {
     $defaultSettings = [['name' => 'app_name', 'value' => 'Cachet Demo'], ['name' => 'app_domain', 'value' => 'https://demo.cachethq.io'], ['name' => 'show_support', 'value' => '1'], ['name' => 'app_locale', 'value' => 'en'], ['name' => 'app_timezone', 'value' => 'Europe/London'], ['name' => 'app_incident_days', 'value' => '7'], ['name' => 'app_analytics', 'value' => 'UA-58442674-3'], ['name' => 'app_analytics_gs', 'value' => 'GSN-712462-P'], ['name' => 'display_graphs', 'value' => '1'], ['name' => 'app_about', 'value' => 'This is the demo instance of [Cachet](https://cachethq.io?ref=demo). The open source status page system, for everyone. An [Alt Three](https://alt-three.com) product.']];
     Setting::truncate();
     foreach ($defaultSettings as $setting) {
         Setting::create($setting);
     }
 }