/** * Always check if the key is generated. * * @author Cali */ protected function generateKeyIfNotGiven() { $config = $this->app->make('config')->get('app'); if (!Str::startsWith($config['key'], 'base64:')) { $key = 'base64:' . base64_encode(random_bytes($config['cipher'] == 'AES-128-CBC' ? 16 : 32)); env_put('APP_KEY', $key); $this->app['config']['app.key'] = $key; } }
/** * Create the admin account and migrate the database. * * @param $credentials * @author Cali */ protected function migrateAndCreateAdmin($credentials) { env_put('ADMIN_EMAIL', $credentials['email'], true); Artisan::call('migrate', ['--force' => 'true']); $admin = User::createAdmin($credentials); Auth::login($admin, true); $this->writeLock(); }
/** * Save develop settings. * * @param Request $request * @author Cali */ public static function saveAdvancedDevelopSettings(Request $request) { if (($env = $request->input('environment', 'local')) != config('app.env')) { env_put('APP_ENV', $env); } $debug = $request->input('debug', 'off') == 'on' ? 'true' : 'false'; env_put('APP_DEBUG', strval($debug)); if (($ignores = $request->input('ignores_admin', 'off') == 'on' ? 1 : 0) != site('adminIgnoresMaintenance')) { static::adminIgnoresMaintenance($ignores); } if (($on = $request->input('maintenance', 'off') === 'on') ^ app()->isDownForMaintenance()) { Artisan::call($on ? 'down' : 'up'); } }