本文整理汇总了PHP中Illuminate\Support\Facades\App::make方法的典型用法代码示例。如果您正苦于以下问题:PHP App::make方法的具体用法?PHP App::make怎么用?PHP App::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api
/**
* Get the API ancestor controller class
* of the current controller class.
*
* @return Esensi\Core\Http\Controllers\ApiController
*/
public function api()
{
// Make a copy of the parent class
$class = get_parent_class();
$parent = App::make($class);
// Copy over the packaged properties
if ($this instanceof PackagedInterface) {
$parent->setUI($this->getUI());
$parent->setPackage($this->getPackage());
$parent->setNamespacing($this->getNamespacing());
}
// Copy over the injected repositories
if ($this instanceof RepositoryInjectedInterface) {
foreach ($this->repositories as $name => $repository) {
$parent->setRepository($repository, $name);
}
}
// Return first ApiController ancestor found
if (str_contains($class, 'ApiController')) {
return $parent;
}
// Recursively look up the parent class
if (method_exists($parent, 'api')) {
return $parent->api();
}
// Return the parent class found already
return $parent;
}
示例2: downloadInvoice
public function downloadInvoice($view, $id)
{
$brochure = App::make('walis-merchant.brochure');
$brochure->loadView($view, InvoiceRepository::find($id));
$filename = 'invoice_' . sha1(date("Y-n-d-His")) . '.pdf';
return $brochure->download($filename);
}
示例3: display
/**
* Display the content of the page
*
* @param $query
* @return \Illuminate\View\View
*/
public function display($query)
{
$title = 'TestView';
$page = "";
$arr = explode('/', $query);
// \App\Page::find(4)->content->find(5)->element->module->name
$heading = \App\Node::findBySlug('header');
// dd(\App\Node::findBySlug($arr[0])->content);
// test
$content = \App\Node::active()->findBySlug($arr[0])->content;
foreach ($content as $item) {
// get the module Name of
// $module = \App\Module::findOrFail($p->module_id);
// resolve the Module Name out of the IOC Container and render the content partiall
// $content .= App::make('module:' . $module->name)->render($p->content_id);
// foreach ($item->content as $content)
// {
//Todo check if Module is Active and Content is Active
$module = $item->element->module->name;
if ($module != 'Heading') {
continue;
}
// resolve the Module out of the IOC Container and render the partial
$page .= App::make('module:' . strtolower($module))->render($item->element->row);
// }
}
return view('layout.master', compact('title', 'page'));
}
示例4: getTraining
public function getTraining()
{
$training = new \Offside\Team\Training($this->trainingRepository);
$javascript = App::make('Javascript');
$javascript::put(['attackTraining' => $training->getAttackDateTime(), 'midfieldTraining' => $training->getMidfieldDateTime(), 'defenseTraining' => $training->getDefenseDateTime(), 'anyTrainingActive' => !$training->allTrainingsDone(), 'elapsedTime' => $training->getElapsedTime()]);
return view("my-team.training");
}
示例5: registerHtmlBuilder
/**
* Register the HTML builder instance.
* This binds the 'html' reference in the IoC container to the package implementation.
* Laravel's HTML Facade will automatically use this when being called
*
* @return void
*/
protected function registerHtmlBuilder()
{
$this->app->bindShared('html', function ($app) {
$urlGenerator = App::make(UrlGenerator::class);
return new HtmlBuilder($urlGenerator);
});
}
开发者ID:inakianduaga,项目名称:laravel-html-builder-extensions,代码行数:14,代码来源:LaravelHtmlBuilderExtensionsServiceProvider.php
示例6: __construct
/**
* @param Proxy $proxy
* @param string $name
*/
public function __construct(Proxy $proxy, $name = '')
{
self::$client = App::make('Elasticsearch');
self::$config = App::make('Menthol\\Flexible\\Config');
$this->setProxy($proxy);
$this->setName($name ?: $proxy->getModel()->getTable());
}
示例7: __construct
public function __construct(QueryStringOperations $qso)
{
$this->queryStringOps = $qso;
$this->request = App::make('request');
$this->url = App::make('url');
$this->config = App::make('config');
}
示例8: handle
/**
* Handle the command
*
* @param BaseCommand|RegisterUserCommand $command
*
* @return mixed
*/
public function handle(BaseCommand $command)
{
$user = new User($command->all());
$user->save();
App::make('Altwallets\\Services\\UserMailer')->sendRegistrationEmail($user);
return $user;
}
示例9: __construct
public function __construct()
{
$this->package = \Vsch\TranslationManager\ManagerServiceProvider::PACKAGE;
$this->packagePrefix = $this->package . '::';
$this->manager = App::make($this->package);
$this->cookiePrefix = $this->manager->getConfig('persistent_prefix', 'K9N6YPi9WHwKp6E3jGbx');
$locale = Cookie::get($this->cookieName(self::COOKIE_LANG_LOCALE), \Lang::getLocale());
App::setLocale($locale);
$this->primaryLocale = Cookie::get($this->cookieName(self::COOKIE_PRIM_LOCALE), $this->manager->getConfig('primary_locale', 'en'));
$this->locales = $this->loadLocales();
$this->translatingLocale = Cookie::get($this->cookieName(self::COOKIE_TRANS_LOCALE));
if (!$this->translatingLocale || $this->translatingLocale === $this->primaryLocale && count($this->locales) > 1) {
$this->translatingLocale = count($this->locales) > 1 ? $this->locales[1] : $this->locales[0];
Cookie::queue($this->cookieName(self::COOKIE_TRANS_LOCALE), $this->translatingLocale, 60 * 24 * 365 * 1);
}
$this->displayLocales = Cookie::has($this->cookieName(self::COOKIE_DISP_LOCALES)) ? Cookie::get($this->cookieName(self::COOKIE_DISP_LOCALES)) : implode(',', array_slice($this->locales, 0, 5));
$this->displayLocales .= implode(',', array_flatten(array_unique(explode(',', ($this->displayLocales ? ',' : '') . $this->primaryLocale . ',' . $this->translatingLocale))));
//$this->sqltraces = [];
//$this->logSql = 0;
//
//$thisController = $this;
//\Event::listen('illuminate.query', function ($query, $bindings, $time, $name) use ($thisController)
//{
// if ($thisController->logSql)
// {
// $thisController->sqltraces[] = ['query' => $query, 'bindings' => $bindings, 'time' => $time];
// }
//});
}
示例10: show
/**
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show($id)
{
$todolist = $this->todolistRepository->byId($id);
$javaScript = App::make('JavaScript');
$javaScript->put(['todolist' => $todolist]);
return view('todolist', compact('todolist'));
}
示例11: __construct
public function __construct()
{
$this->middleware('auth');
// $this->beforeFilter('csrf', ['on' => 'post']);
$this->displayNameField = config('genealabs-bones-keeper.displayNameField');
$this->user = App::make(config('auth.model'));
}
示例12: testSlugRetrieval
/**
* Unfortunately we need to do an Integrated test for this particular use-case.
*/
public function testSlugRetrieval()
{
$account = Account::create([]);
App::make(AccountRepositoryInterface::class)->save($account);
$this->assertNotEmpty($account->slug);
$this->assertInstanceOf(Slug::class, $account->slug);
}
示例13: __construct
public function __construct()
{
$this->request = App::make('request');
$this->config = App::make('config');
$this->serializer = App::make('serializer');
$this->embededResponse = App::make('Symfony\\Component\\HttpFoundation\\Response');
}
示例14: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('odm.documentmanager', function ($app) {
$conn = Config::get('laravel-odm::connection');
return DocumentManager::create(new Connection($conn['server'], $conn['options']), App::make('odm.config'));
});
$this->app->bind('odm.config', function ($app) {
$conn = Config::get('laravel-odm::connection');
$dir = Config::get('laravel-odm::dir');
$config = new Configuration();
$config->setProxyDir($dir['proxy']);
$config->setProxyNamespace('Proxies');
$config->setHydratorDir($dir['hydrator']);
$config->setHydratorNamespace('Hydrators');
$config->setMetadataDriverImpl(App::make('odm.annotation'));
$config->setDefaultDB($conn['options']['db']);
return $config;
});
$this->app->bind('odm.annotation', function ($app) {
$dir = Config::get('laravel-odm::dir');
AnnotationDriver::registerAnnotationClasses();
$reader = new AnnotationReader();
return new AnnotationDriver($reader, $dir['document']);
});
}
示例15: __construct
/**
* Constructor for initialize Paypal.
*/
public function __construct()
{
// Get Cart in Container
$this->cart = App::make('App\\Http\\Cart\\Cart');
$this->_apiContext = Paypal::ApiContext(config('services.paypal.client_id'), config('services.paypal.secret'));
$this->_apiContext->setConfig(['mode' => 'sandbox', 'service.EndPoint' => 'https://api.sandbox.paypal.com', 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => storage_path('logs/paypal.log'), 'log.LogLevel' => 'FINE']);
}