Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     foreach ($this->cookies->getQueuedCookies() as $cookie) {
         $response->headers->setCookie($cookie);
     }
     return $response;
 }
 public function install(Request $request, JarContract $cookie)
 {
     if ($this->isInstalled() === true) {
         throw new \Exception('Already installed');
     }
     app('config')->set('app.debug', true);
     $url = $this->getUrl($request->get('web_url', ''));
     $validator = $this->getValidationFactory()->make(array_merge($request->all(), ['web_url' => $url]), ['admin_email' => 'required|email', 'admin_password' => 'required|confirmed', 'admin_password_confirmation' => 'required', 'database_name' => 'required', 'database_password' => 'required', 'web_url' => 'url']);
     if ($validator->fails()) {
         return $this->back($validator->getMessageBag()->first());
     }
     $configPath = storage_path('app') . '/installConfig';
     $string = Yaml::dump(['site' => ['locale' => $request->get('locale') != '' ? $request->get('locale') : 'ko', 'url' => $url != '' ? $url : 'http://localhost', 'timezone' => $request->get('web_timezone') != '' ? $request->get('web_timezone') : 'Asia/Seoul'], 'admin' => ['email' => $request->get('admin_email'), 'password' => $request->get('admin_password'), 'displayName' => $request->get('admin_display_name') != '' ? $request->get('admin_display_name') : 'admin'], 'database' => ['host' => $request->get('database_host') != '' ? $request->get('database_host') : 'localhost', 'port' => $request->get('database_port') != '' ? $request->get('database_port') : '3306', 'dbname' => $request->get('database_name'), 'username' => $request->get('database_user_name') != '' ? $request->get('database_user_name') : 'root', 'password' => $request->get('database_password'), 'prefix' => $request->get('database_prefix') != '' ? $request->get('database_prefix') : 'xe']]);
     File::put($configPath, $string);
     Artisan::call('xe:install', ['--config' => $configPath, '--no-interaction' => true]);
     File::delete($configPath);
     if (!empty($request->get('locale'))) {
         $cookie->queue($cookie->forever('locale', $request->get('locale')));
     }
     return redirect($request->root());
 }
Ejemplo n.º 3
0
 public function setLocale(JarContract $cookie, $locale)
 {
     $cookie->queue($cookie->forever('locale', $locale));
     return Redirect::back();
 }
Ejemplo n.º 4
0
 /**
  * Append all queued cookies to the response.
  *
  * @param \Symfony\Component\HttpFoundation\Response $response
  * @return void
  */
 protected function writeQueuedCookies(Response $response)
 {
     foreach ($this->queue->getQueuedCookies() as $cookie) {
         $response->headers->setCookie($cookie);
     }
 }