本文整理汇总了PHP中Illuminate\Support\Facades\Artisan::call方法的典型用法代码示例。如果您正苦于以下问题:PHP Artisan::call方法的具体用法?PHP Artisan::call怎么用?PHP Artisan::call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Artisan
的用法示例。
在下文中一共展示了Artisan::call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWithInvalidFilter
public function testWithInvalidFilter()
{
$this->initDB();
$exitCode = Artisan::call('ticket:show', ['ticket' => 'xxx']);
$this->assertEquals($exitCode, 0);
$this->assertContains('No matching ticket was found.', Artisan::output());
}
示例2: makeMigration
public function makeMigration($name)
{
$name = $this->migrationName($name);
if (!class_exists($name)) {
Artisan::call('make:migration', ['name' => $name, '--create' => upperToUnderscore($name)]);
}
}
示例3: testNotFoundFilter
public function testNotFoundFilter()
{
$this->initDB();
$exitCode = Artisan::call('contact:list', ['--filter' => 'xxx']);
$this->assertEquals($exitCode, 0);
$this->assertContains('No contact found for given filter.', Artisan::output());
}
示例4: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$region = $this->argument('regionName');
$this->mswSpotService->getSpotsInRegion($region)->each(function ($spot) {
Artisan::call('msw:import-forecast', ['spotId' => $spot->id]);
});
}
示例5: seed
/**
* Run the seed command for the given module
* @param SeedModuleRequest $request
* @return mixed
*/
public function seed(SeedModuleRequest $request)
{
$output = new BufferedOutput();
Artisan::call('module:seed', ['module' => $request->module], $output);
Flash::message($output->fetch());
return Redirect::route('admin.workshop.workbench.index');
}
示例6: close
public function close()
{
//filesystem
$this->files = new Filesystem();
//php artisan migrate:rollback
$cmd = 'php artisan migrate:rollback';
exec($cmd, $output);
//php artisan delete:relation OrangeType Orange
Artisan::call('delete:relation', (array) ['model_A' => 'OrangeType', 'model_B' => 'Orange']);
//php artisan delete:scaffold OrangeType
Artisan::call('delete:scaffold', (array) ['name' => 'OrangeType']);
//php artisan delete:scaffold Orange
Artisan::call('delete:scaffold', (array) ['name' => 'Orange']);
//delete migration files
$this->deleteMigration($models = ['orange_types', 'oranges']);
//delete public/dog-ears/
$this->files->deleteDirectory('./public/dog-ears');
//delete common view files
if ($this->files->exists('./resources/views/error.blade.php')) {
$this->files->delete('./resources/views/error.blade.php');
}
if ($this->files->exists('./resources/views/layout.blade.php')) {
$this->files->delete('./resources/views/layout.blade.php');
}
if ($this->files->exists('./resources/views/navi.blade.php')) {
$this->files->delete('./resources/views/navi.blade.php');
}
}
示例7: can_publish
/** @test */
public function can_publish()
{
$this->setAnnotationsPath();
Artisan::call('l5-swagger:publish');
$this->assertTrue(file_exists(config_path('l5-swagger.php')));
$this->assertTrue(file_exists(config('l5-swagger.paths.views') . '/index.blade.php'));
}
示例8: testNetBlockListCommandWithValidFilter
public function testNetBlockListCommandWithValidFilter()
{
$exitCode = Artisan::call('netblock:list', ['--filter' => '192.168.1.0']);
$this->assertEquals($exitCode, 0);
$this->assertContains('ISP Business Internet', Artisan::output());
$this->assertNotContains('Customer 1', Artisan::output());
}
示例9: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$namespace = $this->getAppNamespace();
$this->shouldBackup = 'n' === strtolower($this->askWithCompletion('Do you want to overwrite files when copying? (Saying \'no\' will create time-stamped copies of the originals.)', ['y', 'n']));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/app.blade.php', base_path('resources/views/app.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/home.blade.php', base_path('resources/views/home.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/welcome.blade.php', base_path('resources/views/welcome.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/login.blade.php', base_path('resources/views/auth/login.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/password.blade.php', base_path('resources/views/auth/password.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/register.blade.php', base_path('resources/views/auth/register.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/reset.blade.php', base_path('resources/views/auth/reset.blade.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-3.3.5.css.map', public_path('css/bootstrap-3.3.5.css.map'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-3.3.5.min.css', public_path('css/bootstrap-3.3.5.min.css'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-theme.css.map', public_path('css/bootstrap-theme.css.map'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-theme.min.css', public_path('css/bootstrap-theme.min.css'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/js/bootstrap-3.3.5.min.js', public_path('js/bootstrap-3.3.5.min.js'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/js/jquery-2.1.4.min.js', public_path('js/jquery-2.1.4.min.js'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/js/jquery-2.1.4.min.map', public_path('js/jquery-2.1.4.min.map'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.eot', public_path('fonts/glyphicons-halflings-regular.eot'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.svg', public_path('fonts/glyphicons-halflings-regular.svg'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.ttf', public_path('fonts/glyphicons-halflings-regular.ttf'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.woff', public_path('fonts/glyphicons-halflings-regular.woff'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.woff2', public_path('fonts/glyphicons-halflings-regular.woff2'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/routes.php', app_path('Http/routes.php'));
$this->copyJumpstartAsset(__DIR__ . '/../../assets/Controllers/HomeController.php', base_path('app/Http/Controllers/HomeController.php'), $namespace);
$this->copyJumpstartAsset(__DIR__ . '/../../assets/Controllers/WelcomeController.php', base_path('app/Http/Controllers/WelcomeController.php'), $namespace);
$this->copyJumpstartMigrationAsset(__DIR__ . '/../../assets/database/migrations/_add_name_fields_to_users_table_jumpstart.php', base_path('database/migrations/' . Carbon::now()->format('Y_m_d_His') . '_add_name_fields_to_users_table_jumpstart.php'));
$this->copyJumpstartMigrationAsset(__DIR__ . '/../../assets/database/migrations/_add_softdeletes_to_users_table_jumpstart.php', base_path('database/migrations/' . Carbon::now()->format('Y_m_d_His') . '_add_softdeletes_to_users_table_jumpstart.php'));
if ('y' === strtolower($this->ask('Do you want to run the migrations?', 'y'))) {
Artisan::call('migrate');
}
}
示例10: testWithValidFilter
public function testWithValidFilter()
{
$this->initDB();
$exitCode = Artisan::call('user:show', ['user' => $this->user->id]);
$this->assertEquals($exitCode, 0);
$this->assertContains($this->user->first_name, Artisan::output());
}
示例11: beforeTest
/**
* before each test runs
* here we migrate if no migration and reset if migration already run
* TODO: This is not working when Laravel5 transaction mode (cleanup=true in config) is activated, figure out why (eg error: no such table: users in routing/RegisterCest)
*
* @param TestEvent $e
* @return bool
*/
public function beforeTest(TestEvent $e)
{
// instantiate Codeception console output
$output = new Output([]);
// get laravel5 module
$l5 = $this->getModule('Laravel5');
// output error and die if transaction mode is active (this extension does not work with Laravel 5 transaction mode) TODO: figure out why
if ($l5->config['cleanup']) {
$output->writeln("\n[41m" . "Please set Laravel5 Codeception module's cleanup to false (in tests/functional.suite.yml) before using NeilRussell6\\CodeceptionLaravel5Extensions\\ArtisanMigrateExtension." . "[0m");
die;
}
// get current migration status
Artisan::call('migrate:status', ['--database' => $this->connection]);
$status = Artisan::output();
//var_dump($status);
// ... if no migrations the run migrate
if (str_contains($status, "No migrations found")) {
Artisan::call('migrate', ['--database' => $this->connection]);
//$result = Artisan::output();
//var_dump($result);
} else {
Artisan::call('migrate:refresh', ['--database' => $this->connection]);
//$result = Artisan::output();
//var_dump($result);
}
}
示例12: publishAssets
public function publishAssets(Theme $theme)
{
try {
Artisan::call('stylist:publish', ['theme' => $theme->getName()]);
} catch (InvalidArgumentException $e) {
}
}
示例13: optimized_class_is_created_in_production_environment
/** @test */
public function optimized_class_is_created_in_production_environment()
{
$this->assertFileNotExists(base_path('bootstrap/cache/compiled.php'));
Config::set('app.debug', false);
Artisan::call('azure:optimize-classes');
$this->assertFileExists(base_path('bootstrap/cache/compiled.php'));
}
示例14: handle
/**
* Execute the console command.
*
* @return mixed
* @throws \Gitonomy\Git\Exception\RuntimeException
* @throws \Gitonomy\Git\Exception\InvalidArgumentException
*/
public function handle()
{
$inspector = new Inspector($this->settings);
$repository = $inspector->getRepositoryByUrl($this->argument('repositoryUrl'));
$inspectedRepository = $inspector->inspectRepository($repository);
$header = array_keys((array) $inspectedRepository[key($inspectedRepository)]);
if (!$this->option('dry-run')) {
$remote = $inspectedRepository['remote'];
\Swis\GotLaravel\Models\Results::unguard();
foreach ($inspectedRepository['results'] as $result) {
$insert = $result->toArray();
$insert['remote'] = $remote;
$insert['author_slug'] = Str::slug($result->getAuthor());
$insert['created_at'] = Carbon::createFromTimestamp($insert['date']);
try {
\Swis\GotLaravel\Models\Results::updateOrCreate(array_only($insert, ['remote', 'filename', 'line']), $insert);
} catch (\Exception $e) {
$this->error('Couldnt insert: ' . $e->getMessage() . PHP_EOL . print_r($insert, 1));
}
}
}
reset($inspectedRepository['results']);
array_walk($inspectedRepository['results'], function (&$row) {
$row = $row->toArray();
});
$this->info($inspectedRepository['remote']);
$this->table($header, $inspectedRepository['results']);
Artisan::call('got:normalize-names');
}
示例15: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
// Check not 'sync'
if (Config::get('queue.default') == "sync") {
Artisan::call('down');
$this->info("Application maintenance mode enabled.");
return;
}
// Push job onto queue
Queue::push(function ($job) {
// Take Application down.
Artisan::call('down');
// Add Log message
Log::info("Application is down, pausing queue while maintenance happens.");
// Loop, waiting for app to come back up
while (App::isDownForMaintenance()) {
echo ".";
sleep(5);
}
// App is back online, kill worker to restart daemon.
Log::info("Application is up, rebooting queue.");
Artisan::call('queue:restart');
$job->delete();
});
// Wait until Maintenance Mode enabled.
while (!App::isDownForMaintenance()) {
sleep(1);
}
$this->info("Application maintenance mode enabled.");
}