Exemplo n.º 1
0
 /**
  * Refresh the application instance.
  *
  * @return void
  */
 protected function refreshApplication()
 {
     $this->app = $this->createApplication();
     $this->client = $this->createClient();
     $this->app->setRequestForConsoleEnvironment();
     $this->app->boot();
 }
Exemplo n.º 2
0
 /**
  * Create a new Console application.
  *
  * @param  \Nova\Foundation\Application  $app
  * @return \Nova\Console\Application
  */
 public static function make($app)
 {
     $app->boot();
     $console = with($console = new static('Nova Framework', $app::VERSION))->setNova($app)->setExceptionHandler($app['exception'])->setAutoExit(false);
     $app->instance('forge', $console);
     return $console;
 }
Exemplo n.º 3
0
 /**
  * Get the forge console instance.
  *
  * @return \Nova\Console\Application
  */
 protected function getForge()
 {
     if (!is_null($this->forge)) {
         return $this->forge;
     }
     $this->app->loadDeferredProviders();
     $this->forge = ConsoleApplication::make($this->app);
     return $this->forge->boot();
 }
Exemplo n.º 4
0
 /**
  * Register the load events for the given provider.
  *
  * @param  \Nova\Foundation\Application  $app
  * @param  string  $provider
  * @param  array  $events
  * @return void
  */
 protected function registerLoadEvents(Application $app, $provider, array $events)
 {
     if (count($events) < 1) {
         return;
     }
     $app->make('events')->listen($events, function () use($app, $provider) {
         $app->register($provider);
     });
 }
Exemplo n.º 5
0
 /**
  * Register the Module Service Provider.
  *
  * @param string $properties
  *
  * @return string
  *
  * @throws \Nova\Module\FileMissingException
  */
 protected function registerServiceProvider($properties)
 {
     $namespace = $this->resolveNamespace($properties);
     $file = $this->repository->getPath() . DS . $namespace . DS . 'Providers' . DS . $namespace . 'ServiceProvider.php';
     $serviceProvider = $this->repository->getNamespace() . "\\{$namespace}\\Providers\\{$namespace}ServiceProvider";
     if (class_exists($serviceProvider)) {
         $this->app->register($serviceProvider);
     }
 }
Exemplo n.º 6
0
 /**
  * Register the Module Service Provider.
  *
  * @param array $properties
  *
  * @return void
  *
  * @throws \Nova\Module\FileMissingException
  */
 protected function registerServiceProvider($properties)
 {
     $namespace = $this->resolveNamespace($properties);
     $file = $this->getPath() . $namespace . DS . 'Providers' . DS . $namespace . 'ServiceProvider.php';
     // Calculate the name of Service Provider, including the namespace.
     $serviceProvider = $this->getNamespace() . "\\{$namespace}\\Providers\\{$namespace}ServiceProvider";
     if (class_exists($serviceProvider)) {
         $this->app->register($serviceProvider);
     }
 }
Exemplo n.º 7
0
 /**
  * Prepare the database connection instance.
  *
  * @param  \Nova\Database\Connection  $connection
  * @return \Nova\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // The database connection can also utilize a cache manager instance when cache
     // functionality is used on queries, which provides an expressive interface
     // to caching both fluent queries and ORM queries that are executed.
     $app = $this->app;
     $connection->setCacheManager(function () use($app) {
         return $app['cache'];
     });
     // We will setup a Closure to resolve the paginator instance on the connection
     // since the Paginator isn't used on every request and needs quite a few of
     // our dependencies. It'll be more efficient to lazily resolve instances.
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     // Here we'll set a reconnector callback. This reconnector can be any callable
     // so we will set a Closure to reconnect from this manager with the name of
     // the connection, which will allow us to reconnect from the connections.
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
Exemplo n.º 8
0
 /**
  * Prepare the database connection instance.
  *
  * @param  \Nova\Database\Connection  $connection
  * @return \Nova\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     $app = $this->app;
     $connection->setCacheManager(function () use($app) {
         return $app['cache'];
     });
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
Exemplo n.º 9
0
define('VERSION', Application::VERSION);
//--------------------------------------------------------------------------
// Setup The Framework Environment
//--------------------------------------------------------------------------
defined('ENVIRONMENT') || define('ENVIRONMENT', 'development');
//--------------------------------------------------------------------------
// Load The Global Configuration
//--------------------------------------------------------------------------
$path = APPDIR . 'Config.php';
if (is_readable($path)) {
    require $path;
}
//--------------------------------------------------------------------------
// Create New Application
//--------------------------------------------------------------------------
$app = new Application();
$app->instance('app', $app);
//--------------------------------------------------------------------------
// Detect The Application Environment
//--------------------------------------------------------------------------
$env = $app->detectEnvironment(array('local' => array('darkstar')));
//--------------------------------------------------------------------------
// Bind Paths
//--------------------------------------------------------------------------
$paths = array('base' => ROOTDIR, 'app' => APPDIR, 'public' => PUBLICDIR, 'storage' => STORAGE_PATH);
$app->bindInstallPaths($paths);
//--------------------------------------------------------------------------
// Load The Framework Facades
//--------------------------------------------------------------------------
Facade::clearResolvedInstances();
Facade::setFacadeApplication($app);
Exemplo n.º 10
0
 /**
  * Convert a BrowserKit request into a Nova request.
  *
  * @param  \Symfony\Component\BrowserKit\Request  $request
  * @return \Nova\Http\Request
  */
 protected function filterRequest(DomRequest $request)
 {
     $httpRequest = Application::onRequest('create', $this->getRequestParameters($request));
     $httpRequest->files->replace($this->filterFiles($httpRequest->files->all()));
     return $httpRequest;
 }