本文整理汇总了PHP中App::make方法的典型用法代码示例。如果您正苦于以下问题:PHP App::make方法的具体用法?PHP App::make怎么用?PHP App::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$lrs_collection = (new Lrs())->get();
// Remove all inactive statements.
Statement::where('active', '=', false)->delete();
// Migrates the statements for each LRS.
foreach ($lrs_collection as $lrs) {
Statement::where('lrs._id', $lrs->_id)->chunk(500, function ($statements) use($lrs) {
$statements_array = [];
// Sets `active` and `voided` properties.
// Ensures that statement is an associative array.
$statements = $statements->each(function ($statement) {
$statement->voided = isset($statement->voided) ? $statement->voided : false;
$statement->active = isset($statement->active) ? $statement->active : true;
$statement->save();
$statements_array[] = (array) json_decode($statement->toJSON());
});
// Uses the repository to migrate the statements.
$repo = App::make('Locker\\Repository\\Statement\\EloquentVoider');
$repo->updateReferences($statements_array, $lrs);
$repo->voidStatements($statements_array, $lrs);
// Outputs status.
$statement_count = $statements->count();
$this->info("Migrated {$statement_count} statements in `{$lrs->title}`.");
});
}
$this->info('All statements migrated.');
}
示例2: handle
/**
* Execute the job.
* @return void
*/
public function handle()
{
$s3 = \App::make('aws');
$s3->createClient('s3')->putObject(['Bucket' => 'transcoderinput435983', 'Key' => $this->key_input, 'SourceFile' => storage_path() . '/app/' . $this->key_input]);
$s3->createClient('ElasticTranscoder')->createJob(['PipelineId' => env('PIPLINE_ID'), 'Input' => ['Key' => $this->key_input, 'FrameRate' => 'auto', 'Resolution' => 'auto', 'AspectRatio' => 'auto', 'Interlaced' => 'auto', 'Container' => 'auto'], 'Output' => ['Key' => $this->key_output, 'ThumbnailPattern' => $this->time . '_thumb{count}', 'Rotate' => 'auto', 'PresetId' => '1452215960232-me3asn']]);
\File::delete(storage_path() . '/app/' . $this->key_input);
}
示例3: save
/**
* Saves all datamodels in all services to the database.
*/
public function save()
{
$data = $this->getData();
$repo = \App::make(YoutubeRepository::class);
call_user_func([$repo, 'save' . ucfirst(str_plural($this->_params->get('resource')['name']))], $data);
event(new PackageSaved($this));
}
示例4: __construct
/**
* Create a new command instance.
*
* @return void
*/
function __construct()
{
parent::__construct();
$this->prod_delete_req_repo = App::make('Giftertipster\\Repository\\ProductDeleteRequest\\ProductDeleteRequestRepositoryInterface');
$this->prod_suite_repo = App::make('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface');
$this->cache_refresher = App::make('Giftertipster\\Service\\Cache\\CacheRefresherInterface');
}
示例5: __construct
public function __construct($name, $payload = null)
{
$this->name = $name;
$this->aggregate_hash = \App::make('guid.aggregate_hash');
$this->payload = new EventPayload($payload);
$this->logger = new EventLogger($this);
}
示例6: __construct
public function __construct()
{
$dashboard = App::make('Lib\\Repositories\\Dashboard\\DashboardRepositoryInterface');
$validator = App::make('Lib\\Services\\Validation\\DashboardValidator');
$scraper = App::make('Lib\\Services\\Scraping\\Scraper');
parent::__construct($dashboard, $validator, $scraper);
}
示例7: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('djbarnes/l4-ldap-auth');
\Auth::extend('l4-ldap-auth', function () {
return new Guard(new L4LdapAuthUserProvider(\Config::get('l4-ldap-auth::ldapserver'), \Config::get('l4-ldap-auth::ldapadmindn'), \Config::get('l4-ldap-auth::ldapadminpw'), \Config::get('l4-ldap-auth::searchbase'), \Config::get('l4-ldap-auth::searchfield')), \App::make('session'));
});
}
示例8: testToGenerateService
public function testToGenerateService(UnitTester $I)
{
$client = \App::make('Stigma\\Nagios\\Client');
$data = [];
$response = $client->generateService($data);
$I->assertEquals('200', $response);
}
示例9: __construct
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->errors = new \Illuminate\Support\MessageBag();
$this->validator = \App::make('validator');
$this->manejaConcurrencia = true;
}
示例10: sitemap
public function sitemap()
{
// create new sitemap object
$sitemap = \App::make('sitemap');
$date = new \DateTime();
// set cache key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean)
// by default cache is disabled
$sitemap->setCache('laravel.sitemap', 60);
// check if there is cached sitemap and build new only if is not
if (!$sitemap->isCached()) {
// add item with translations (url, date, priority, freq, images, title, translations)
$translations = [['language' => 'en', 'url' => \URL::to('/en')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK')]];
$sitemap->add(\URL::to('/'), $date->format('Y-m-d') . 'T00:00:00+08:00', '1', 'weekly', [], null, $translations);
$translations = [['language' => 'en', 'url' => \URL::to('/en/portfolio')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/作品集')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/作品集')]];
$sitemap->add(\URL::to('/作品集'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
$translations = [['language' => 'en', 'url' => \URL::to('/en/freelance-HK')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/香港freelance')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/香港freelance')]];
$sitemap->add(\URL::to('/香港freelance'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
$translations = [['language' => 'en', 'url' => \URL::to('/en/web-design-host-seo')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/网页设计-寄存-SEO')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/網頁設計-寄存-SEO')]];
$sitemap->add(\URL::to('/網頁設計-寄存-SEO'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
$translations = [['language' => 'en', 'url' => \URL::to('/en/choose-online-partner')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/网站顾问')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/網站顧問')]];
$sitemap->add(\URL::to('/網站顧問'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
$translations = [['language' => 'en', 'url' => \URL::to('/en/contact-freelance')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/联络freelance')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/聯絡freelance')]];
$sitemap->add(\URL::to('/聯絡freelance'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
}
// show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
return $sitemap->render('xml');
}
示例11: slim
/**
* Get the available container instance.
*
* @param string $key
* @return mixed|\Slim\Slim
*/
function slim($key = '')
{
if (is_null($key)) {
return App::container;
}
return App::make($key);
}
示例12: test_it_persists_a_todolist_for_a_given_user
public function test_it_persists_a_todolist_for_a_given_user()
{
$user = \Laracasts\TestDummy\Factory::create(App\Umbrella\User\User::class);
$todolistRepo = App::make('App\\Umbrella\\Todo\\Repository\\TodolistRepositoryInterface');
$todolist = $todolistRepo->create('Private', $user);
$this->seeInDatabase('todolist', ['name' => 'Private']);
}
示例13: setUp
public function setUp()
{
parent::setUp();
\App::bind("App\\Repositories\\RecipeRepositoryInterface", "App\\Tests\\StubRepositories\\RecipeRepository");
\App::bind("App\\Presenter\\FeedInterface", "App\\Presenter\\Feed");
$this->controller = new FeedController(\App::make("App\\Presenter\\FeedInterface"), \App::make("App\\Repositories\\RecipeRepositoryInterface"));
}
示例14: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$asset = \App::make('asset');
$asset->styles();
$asset->scripts();
$this->line('Generated and published assets');
}
示例15: setUp
public function setUp()
{
// During the parent's setup, both a 'es' 'Spanish' and 'en' 'English' languages are inserted into the database.
parent::setUp();
$this->languageRepository = \App::make(LanguageRepository::class);
$this->translationRepository = \App::make(TranslationRepository::class);
}