本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::make方法的具体用法?PHP Application::make怎么用?PHP Application::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Foundation\Application
的用法示例。
在下文中一共展示了Application::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attach
/**
* Instanciate and execute all functions as blade extends
*
* @param Application $app The current application
*/
public static function attach(Application $app)
{
/** @var \Illuminate\View\Compilers\BladeCompiler $blade */
$blade = $app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
$config = $app->make('config');
$class = new static();
if (!isset($class->directivesFile)) {
$class->directivesFile = __DIR__ . '/../directives.php';
}
$blacklist = isset($class->blacklist) ? $class->blacklist : $config->get('blade_extensions.blacklist');
$directives = isset($class->directives) ? $class->directives : $app->make('files')->getRequire($class->directivesFile);
$overrides = isset($class->overrides) ? $class->overrides : $config->get('blade_extensions.overrides', []);
foreach ($overrides as $method => $override) {
if (!isset($directives[$method])) {
continue;
}
if (isset($override['pattern'])) {
$directives[$method]['pattern'] = $override['pattern'];
}
if (isset($override['replacement'])) {
$directives[$method]['replacement'] = $override['replacement'];
}
}
foreach ($directives as $name => $directive) {
$method = 'directive' . ucfirst($name);
if (is_array($blacklist) && in_array($name, $blacklist, true) || !method_exists($class, $method)) {
continue;
}
$blade->extend(function ($value) use($class, $method, $directive, $app, $blade) {
return $class->{$method}($value, $directive['pattern'], $directive['replacement'], $app, $blade);
});
}
}
示例2: getNamespace
/**
* @param $name
* @throws UnexpectedValueException
* @return \LaravelCommode\Bladed\Interfaces\IBladedCommand
*/
public function getNamespace($name)
{
if (!array_key_exists($name, $this->namespaces)) {
throw new UnexpectedValueException("Unknown blade command namespace - {$name}.");
}
return $this->application->make("{$this->iocRegistry}.{$name}");
}
示例3: build
/**
* @param string $key
*
* @return RepositoryInterface
*/
public function build($key)
{
$class = $this->registry->get($key);
if ($class) {
return $this->application->make($class);
}
}
示例4: subscribe
public function subscribe(Dispatcher $event)
{
if (static::$called) {
return;
}
// only actively do something in case the default cache driver has been changed
if ($this->settings->get('hyn.cache.driver', 'file') != 'file') {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $this->application->make('config');
$cacheConfig = ['driver' => $this->settings->get('hyn.cache.driver')];
switch ($this->settings->get('hyn.cache.driver')) {
case 'database':
$merge = ['table' => $this->settings->get('hyn.cache.table', 'cache'), 'connection' => $this->settings->get('hyn.cache.connection')];
break;
case 'redis':
$merge = ['connection' => $this->settings->get('hyn.cache.connection')];
break;
case 'memcached':
// @todo..
break;
default:
$merge = [];
}
// merges driver specific settings into the config
$cacheConfig = array_merge($cacheConfig, $merge);
// sets the cache store
$config->set('cache.stores.hyn-cache', $cacheConfig);
$config->set('cache.driver', 'hyn-cache');
}
}
示例5: __construct
public function __construct($memcached, Application $app)
{
$this->memcached = $memcached;
//force expiry to be in seconds from minutes
$this->sessionExpiry = $app->make('config')->get('session.lifetime') * 60;
$this->sessionPrefix = $app->make('config')->get('session.cookie');
}
示例6: resolve
/**
* Add a command, resolving through the application.
*
* @param string $command
*
* @return \Symfony\Component\Console\Command\Command
*/
public function resolve($command)
{
if (is_null($this->container)) {
$this->container = Container::getInstance();
}
return $this->add($this->container->make($command));
}
示例7: getMiddleware
/**
* {@inheritdoc}
*/
protected function getMiddleware(Application $app)
{
$pipe = new MiddlewarePipe();
$path = config('hyn.laravel-flarum.paths.api');
// if ($app->isInstalled() && $app->isUpToDate()) {
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
$pipe->pipe($path, $app->make('Flarum\\Api\\Middleware\\FakeHttpMethods'));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\StartSession'));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\RememberFromCookie'));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithSession'));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithHeader'));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\SetLocale'));
event(new ConfigureMiddleware($pipe, $path, $this));
$pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.api.routes')]));
$pipe->pipe($path, $app->make('Flarum\\Api\\Middleware\\HandleErrors'));
// } else {
// $pipe->pipe($path, function () {
// $document = new Document;
// $document->setErrors([
// [
// 'code' => 503,
// 'title' => 'Service Unavailable'
// ]
// ]);
//
// return new JsonApiResponse($document, 503);
// });
// }
return $pipe;
}
示例8: getAbstractionLayer
/**
* {@inheritdoc}
*/
public function getAbstractionLayer($modelName)
{
$modelInstance = $this->getModelInstance($modelName);
$args = ['model' => $modelInstance];
$dbal = $this->app->make('ANavallaSuiza\\Laravel\\Database\\Dbal\\Eloquent\\AbstractionLayer', $args);
return $dbal;
}
示例9: registerUserVerification
/**
* Register the user verification.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
protected function registerUserVerification(Application $app)
{
$app->bind('user.verification', function ($app) {
return new UserVerification($app->make('mailer'), $app->make('db')->connection()->getSchemaBuilder());
});
$app->alias('user.verification', UserVerification::class);
}
示例10: loadConfig
/**
* Load configures from config file.
*/
protected function loadConfig()
{
$config = $this->app->make('config');
/**
* How many entries per page.
*/
$this->cacheLive = $config->get('housekeeper.repository.cache.live', 300);
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->validator->validateRequest($request)) {
$request = $this->app->make('Dingo\\Api\\Contract\\Http\\Request')->createFromIlluminate($request);
return $this->sendRequestThroughRouter($request);
}
return $next($request);
}
示例12: bootstrap
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
public function bootstrap(Application $app)
{
if ($app->make('orchestra.extension.status')->is('safe')) {
$app->make('orchestra.messages')->extend(function (MessageBag $messages) {
$messages->add('info', trans('orchestra/foundation::response.safe-mode'));
});
}
}
示例13: boot
/**
* Function to boot indexer
* @see
*/
public function boot()
{
$this->events = $this->app->make('events');
// Loop events
foreach ($this->eloquentEvents as $event) {
$this->events->listen('eloquent.' . $event . '*', ElasticListener::class . '@' . $event);
}
}
示例14: call
/**
* Call the given URI and return a Response.
*
* @param string $uri
*
* @return \Illuminate\Http\Response
*/
protected function call($uri)
{
$request = Request::create($uri, 'GET');
$kernel = $this->app->make(HttpKernel::class);
$response = $kernel->handle($request);
$kernel->terminate($request, $response);
return $response;
}
示例15: getAllHooksImplementations
private function getAllHooksImplementations()
{
$this->implementations = [];
foreach ($this->getAllHooks() as $hookClass) {
$this->implementations[] = $this->app->make($hookClass);
}
return $this->implementations;
}