Bootstrap Orchestra Platform Foundation.

@return $this
507278
public function withFoundation()
    {
        $this->make('events')->listen('orchestra.auth: roles', UserAccess::class);

        $this->registerMemoryBindings();
        $this->registerAuthorizationBindings();

        return $this;
    }
1181124
protected function setMosaicDefaultListMode(): self
    {
        if (null !== $this->request) {
            if ($mode = $this->request->query->get('_list_mode')) {
                $this->setListMode($mode);
            } else {
                $this->setListMode('mosaic');
            }
        }

        return $this;
    }
1299626
public function bootstrap(EventInterface $initEvent = null)
    {
        if ($initEvent === null) {
            $initEvent = new Event('proem.init');
        }

        $this->assetManager->resolve('eventManager')->trigger($initEvent);

        $this->assetManager->resolve('chainManager')
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Request'))
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Route'))
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Dispatch'))
            ->bootstrap();

        return $this;
    }
114255
protected function platform()
    {
        if (! $this->platform )
            $this->platform = new PlatformRest;


        # Default Options Overriding
        $this->platform->setServerUrl( $this->serverUrl );

        return $this->platform;
    }
973365
public function bootstrapUserCode()
    {
        // Clean previously registered events
        $this->tasks->clearRegisteredEvents();
        $this->bootstrapPlugins();

        // Get the registered events
        $hooks = (array) $this->config->getContextually('hooks');
        $tasks = isset($hooks['tasks']) ? (array) $hooks['tasks'] : [];
        $roles = isset($hooks['roles']) ? (array) $hooks['roles'] : [];
        $events = isset($hooks['events']) ? (array) $hooks['events'] : [];

        // Bind tasks and commands
        foreach ($tasks as $name => $task) {
            try {
                $this->tasks->task($name, $task);
            } catch (TaskCompositionException $exception) {
                $this->tasks->command($name, $task);
            }
        }

        // Bind events
        $this->events->onTag('hooks', function () use ($events) {
            foreach ($events as $event => $tasks) {
                foreach ($tasks as $task => $listeners) {
                    $this->tasks->addTaskListeners($task, $event, $listeners, 0);
                }
            }
        });

        // Assign roles
        $this->roles->assignTasksRoles($roles);
    }
638459
public function bootstrap()
    {
        $providers = Zilf::$container->getShare('config')->get('services');

        foreach ($providers as $provider) {
            $instance = $this->createProvider($provider);
            $instance->register();
        }
    }
1127167
protected function bootFilters()
	{
		if (config('api.cors_enabled', true)) {
			$this->app['router']->before(function ($request) {
				if (Request::header('Origin') && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
					$response = Response::make(null, 204);
					Cors::attachHeaders($response);
					Cors::attachOriginHeader($response, Request::header('Origin'));
					return $response;
				}
			});
			
			$this->app['router']->after(function ($request, $response) {
				if (Request::header('Origin')) {
					Cors::attachHeaders($response);
					Cors::attachOriginHeader($response, Request::header('Origin'));
				}
			});
		}
		
		$this->app['router']->filter('protect', function ($route, $request) {
			Api::protect();
		});
		
		$this->app['router']->filter('checkscope', function ($route, $request, $scope = '') {
			// B/c Laravel uses : as a special character already.
			$scope = str_replace('.', ':', $scope);
			
			Api::checkScope($scope);
		});
	}
390762
static private function bootstrap()
    {
        if (self::$expressions === null) {
            $configuration = new Configuration();
            $parameters = $configuration->getConfig();
            self::$expressions = $configuration->setUp($parameters);
        }
    }
423166
public function enable(): self
    {
        if (!empty($this->logs)) {
            $this->logs->addListener($this);
        }

        return $this;
    }
786891
public function boot()
	{
		// Set up the framework core

		$this->initialize();

		// Configure

		$this->configure();

		// Register services in the IoC injection container

		$this->registerServices();

		// Register class aliases

		$this->registerClassAliases();

		// Load the application bootstrap file

		$this->bootstrap();

		// Boot packages

		$this->bootPackages();

		// Return application instnace

		return $this;
	}
718442
protected function registerFoundation()
    {
        $this->app['orchestra.installed'] = false;

        $this->app->singleton('orchestra.app', function (Application $app) {
            return new Foundation($app, new RouteResolver($app));
        });
    }
449265
protected function bootstrap()
    {
        $serviceManager = $this->getServiceManager();

        $application = $this->getServiceManager()
            ->get('Application');

        // Setup MVC Event
        $this->event = $event  = new MvcEvent();
        $event->setTarget($application);
        $event->setApplication($application)
            ->setRequest($this->getRequest())
            ->setResponse($this->getResponse())
            ->setRouter($serviceManager->get('Router'));

        // Trigger bootstrap events
        $this->getEventManager()
            ->trigger(MvcEvent::EVENT_BOOTSTRAP, $event);
    }
1137568
public function boot() {

		// Reference
		$self = $this;

		// Register Eloquent Hooks
		Event::listen('eloquent.created: *', function($obj) use ($self) { return $self->sync($obj); }, 10);
		Event::listen('eloquent.updated: *', function($obj) use ($self) { return $self->sync($obj); }, 10);
		Event::listen('eloquent.deleted: *', function($obj) use ($self) { return $self->delete($obj); }, 10);
	}
850399
protected function updateComposerConfig()
    {
        parent::updateComposerConfig();
        $this->composerManager->updateProjectConfig(array(
            'name' => $this->composerManager->createPackageName($this->projectName),
            'license' => 'proprietary',
            'description' => null,
            'extra' => array('branch-alias' => null),
        ));

        return $this;
    }
1070491
public function setEnvironment(string $environment): Bootstrap
    {
        Environment::validateEnvironment($environment);
        $this->environment = $environment;

        return $this;
    }
93229
private function bootCanonicalViewComposer()
    {
        View::composer('maxfactor::components.canonical', function ($view) {
            $responseData = collect($view->getData())->toArray();

            $canonical = collect($responseData)->map(function ($item, $key) {
                return collect($item)->get('canonical') ?? null;
            })->filter()->first();

            View::share('canonicalLink', $canonical);
        });
    }
1187949
private function makeRoot()
    {
        $this->lft = 1;
        $this->rgt = 2;
        $this->level = 1;
        $this->root = $this->getMaxRoot();

        return $this;
    }