Commaaa2
This commit is contained in:
@@ -34,7 +34,20 @@ class CastMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/cast.stub';
|
||||
return $this->resolveStubPath('/stubs/cast.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ class ChannelMakeCommand extends GeneratorCommand
|
||||
protected function buildClass($name)
|
||||
{
|
||||
return str_replace(
|
||||
'DummyUser',
|
||||
['DummyUser', '{{ userModel }}'],
|
||||
class_basename($this->userProviderModel()),
|
||||
parent::buildClass($name)
|
||||
);
|
||||
|
||||
@@ -27,11 +27,11 @@ class ClearCompiledCommand extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (file_exists($servicesPath = $this->laravel->getCachedServicesPath())) {
|
||||
if (is_file($servicesPath = $this->laravel->getCachedServicesPath())) {
|
||||
@unlink($servicesPath);
|
||||
}
|
||||
|
||||
if (file_exists($packagesPath = $this->laravel->getCachedPackagesPath())) {
|
||||
if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) {
|
||||
@unlink($packagesPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,17 @@ class ClosureCommand extends Command
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description for the command.
|
||||
*
|
||||
* @param string $description
|
||||
* @return $this
|
||||
*/
|
||||
public function purpose($description)
|
||||
{
|
||||
return $this->describe($description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description for the command.
|
||||
*
|
||||
|
||||
@@ -54,15 +54,21 @@ class ComponentMakeCommand extends GeneratorCommand
|
||||
protected function writeView()
|
||||
{
|
||||
$path = $this->viewPath(
|
||||
str_replace('.', '/', 'components.'.$this->getView())
|
||||
str_replace('.', '/', 'components.'.$this->getView()).'.blade.php'
|
||||
);
|
||||
|
||||
if (! $this->files->isDirectory(dirname($path))) {
|
||||
$this->files->makeDirectory(dirname($path), 0777, true, true);
|
||||
}
|
||||
|
||||
if ($this->files->exists($path) && ! $this->option('force')) {
|
||||
$this->error('View already exists!');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
file_put_contents(
|
||||
$path.'.blade.php',
|
||||
$path,
|
||||
'<div>
|
||||
<!-- '.Inspiring::quote().' -->
|
||||
</div>'
|
||||
@@ -79,14 +85,14 @@ class ComponentMakeCommand extends GeneratorCommand
|
||||
{
|
||||
if ($this->option('inline')) {
|
||||
return str_replace(
|
||||
'DummyView',
|
||||
['DummyView', '{{ view }}'],
|
||||
"<<<'blade'\n<div>\n <!-- ".Inspiring::quote()." -->\n</div>\nblade",
|
||||
parent::buildClass($name)
|
||||
);
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
'DummyView',
|
||||
['DummyView', '{{ view }}'],
|
||||
'view(\'components.'.$this->getView().'\')',
|
||||
parent::buildClass($name)
|
||||
);
|
||||
@@ -115,7 +121,20 @@ class ComponentMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/view-component.stub';
|
||||
return $this->resolveStubPath('/stubs/view-component.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ConsoleMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
|
||||
@@ -2,29 +2,33 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use App\Http\Middleware\PreventRequestsDuringMaintenance;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\InteractsWithTime;
|
||||
use Illuminate\Foundation\Events\MaintenanceModeEnabled;
|
||||
use Illuminate\Foundation\Exceptions\RegisterErrorViewPaths;
|
||||
use Throwable;
|
||||
|
||||
class DownCommand extends Command
|
||||
{
|
||||
use InteractsWithTime;
|
||||
|
||||
/**
|
||||
* The console command signature.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'down {--message= : The message for the maintenance mode}
|
||||
protected $signature = 'down {--redirect= : The path that users should be redirected to}
|
||||
{--render= : The view that should be prerendered for display during maintenance mode}
|
||||
{--retry= : The number of seconds after which the request may be retried}
|
||||
{--allow=* : IP or networks allowed to access the application while in maintenance mode}';
|
||||
{--refresh= : The number of seconds after which the browser may refresh}
|
||||
{--secret= : The secret phrase that may be used to bypass maintenance mode}
|
||||
{--status=503 : The status code that should be used when returning the maintenance mode response}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Put the application into maintenance mode';
|
||||
protected $description = 'Put the application into maintenance / demo mode';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
@@ -34,15 +38,23 @@ class DownCommand extends Command
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
if (file_exists(storage_path('framework/down'))) {
|
||||
if (is_file(storage_path('framework/down'))) {
|
||||
$this->comment('Application is already down.');
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_put_contents(storage_path('framework/down'),
|
||||
json_encode($this->getDownFilePayload(),
|
||||
JSON_PRETTY_PRINT));
|
||||
file_put_contents(
|
||||
storage_path('framework/down'),
|
||||
json_encode($this->getDownFilePayload(), JSON_PRETTY_PRINT)
|
||||
);
|
||||
|
||||
file_put_contents(
|
||||
storage_path('framework/maintenance.php'),
|
||||
file_get_contents(__DIR__.'/stubs/maintenance-mode.stub')
|
||||
);
|
||||
|
||||
$this->laravel->get('events')->dispatch(MaintenanceModeEnabled::class);
|
||||
|
||||
$this->comment('Application is now in maintenance mode.');
|
||||
} catch (Exception $e) {
|
||||
@@ -62,13 +74,58 @@ class DownCommand extends Command
|
||||
protected function getDownFilePayload()
|
||||
{
|
||||
return [
|
||||
'time' => $this->currentTime(),
|
||||
'message' => $this->option('message'),
|
||||
'except' => $this->excludedPaths(),
|
||||
'redirect' => $this->redirectPath(),
|
||||
'retry' => $this->getRetryTime(),
|
||||
'allowed' => $this->option('allow'),
|
||||
'refresh' => $this->option('refresh'),
|
||||
'secret' => $this->option('secret'),
|
||||
'status' => (int) $this->option('status', 503),
|
||||
'template' => $this->option('render') ? $this->prerenderView() : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paths that should be excluded from maintenance mode.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function excludedPaths()
|
||||
{
|
||||
try {
|
||||
return $this->laravel->make(PreventRequestsDuringMaintenance::class)->getExcludedPaths();
|
||||
} catch (Throwable $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path that users should be redirected to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function redirectPath()
|
||||
{
|
||||
if ($this->option('redirect') && $this->option('redirect') !== '/') {
|
||||
return '/'.trim($this->option('redirect'), '/');
|
||||
}
|
||||
|
||||
return $this->option('redirect');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prerender the specified view so that it can be rendered even before loading Composer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function prerenderView()
|
||||
{
|
||||
(new RegisterErrorViewPaths)();
|
||||
|
||||
return view($this->option('render'), [
|
||||
'retryAfter' => $this->option('retry'),
|
||||
])->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of seconds the client should wait before retrying their request.
|
||||
*
|
||||
|
||||
@@ -46,7 +46,20 @@ class EventMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/event.stub';
|
||||
return $this->resolveStubPath('/stubs/event.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class JobMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
|
||||
@@ -57,7 +57,7 @@ class Kernel implements KernelContract
|
||||
/**
|
||||
* The bootstrap classes for the application.
|
||||
*
|
||||
* @var array
|
||||
* @var string[]
|
||||
*/
|
||||
protected $bootstrappers = [
|
||||
\Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
|
||||
@@ -111,7 +111,7 @@ class Kernel implements KernelContract
|
||||
*/
|
||||
protected function scheduleCache()
|
||||
{
|
||||
return Env::get('SCHEDULE_CACHE_DRIVER');
|
||||
return $this->app['config']->get('cache.schedule_store', Env::get('SCHEDULE_CACHE_DRIVER'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ class Kernel implements KernelContract
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Closure based commands for the application.
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ class Kernel implements KernelContract
|
||||
$command = $namespace.str_replace(
|
||||
['/', '.php'],
|
||||
['\\', ''],
|
||||
Str::after($command->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR)
|
||||
Str::after($command->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR)
|
||||
);
|
||||
|
||||
if (is_subclass_of($command, Command::class) &&
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ListenerMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
@@ -44,15 +47,15 @@ class ListenerMakeCommand extends GeneratorCommand
|
||||
'Illuminate',
|
||||
'\\',
|
||||
])) {
|
||||
$event = $this->laravel->getNamespace().'Events\\'.$event;
|
||||
$event = $this->laravel->getNamespace().'Events\\'.str_replace('/', '\\', $event);
|
||||
}
|
||||
|
||||
$stub = str_replace(
|
||||
'DummyEvent', class_basename($event), parent::buildClass($name)
|
||||
['DummyEvent', '{{ event }}'], class_basename($event), parent::buildClass($name)
|
||||
);
|
||||
|
||||
return str_replace(
|
||||
'DummyFullEvent', trim($event, '\\'), $stub
|
||||
['DummyFullEvent', '{{ eventNamespace }}'], trim($event, '\\'), $stub
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class MailMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
@@ -39,7 +43,7 @@ class MailMakeCommand extends GeneratorCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->option('markdown')) {
|
||||
if ($this->option('markdown') !== false) {
|
||||
$this->writeMarkdownTemplate();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +56,7 @@ class MailMakeCommand extends GeneratorCommand
|
||||
protected function writeMarkdownTemplate()
|
||||
{
|
||||
$path = $this->viewPath(
|
||||
str_replace('.', '/', $this->option('markdown')).'.blade.php'
|
||||
str_replace('.', '/', $this->getView()).'.blade.php'
|
||||
);
|
||||
|
||||
if (! $this->files->isDirectory(dirname($path))) {
|
||||
@@ -72,13 +76,29 @@ class MailMakeCommand extends GeneratorCommand
|
||||
{
|
||||
$class = parent::buildClass($name);
|
||||
|
||||
if ($this->option('markdown')) {
|
||||
$class = str_replace('DummyView', $this->option('markdown'), $class);
|
||||
if ($this->option('markdown') !== false) {
|
||||
$class = str_replace(['DummyView', '{{ view }}'], $this->getView(), $class);
|
||||
}
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getView()
|
||||
{
|
||||
$view = $this->option('markdown');
|
||||
|
||||
if (! $view) {
|
||||
$view = 'mail.'.Str::kebab(class_basename($this->argument('name')));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
@@ -86,9 +106,23 @@ class MailMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('markdown')
|
||||
? __DIR__.'/stubs/markdown-mail.stub'
|
||||
: __DIR__.'/stubs/mail.stub';
|
||||
return $this->resolveStubPath(
|
||||
$this->option('markdown') !== false
|
||||
? '/stubs/markdown-mail.stub'
|
||||
: '/stubs/mail.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +146,7 @@ class MailMakeCommand extends GeneratorCommand
|
||||
return [
|
||||
['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the mailable already exists'],
|
||||
|
||||
['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable'],
|
||||
['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable', false],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ModelMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
@@ -45,6 +48,7 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
$this->input->setOption('seed', true);
|
||||
$this->input->setOption('migration', true);
|
||||
$this->input->setOption('controller', true);
|
||||
$this->input->setOption('policy', true);
|
||||
$this->input->setOption('resource', true);
|
||||
}
|
||||
|
||||
@@ -63,6 +67,10 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
if ($this->option('controller') || $this->option('resource') || $this->option('api')) {
|
||||
$this->createController();
|
||||
}
|
||||
|
||||
if ($this->option('policy')) {
|
||||
$this->createPolicy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +80,7 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function createFactory()
|
||||
{
|
||||
$factory = Str::studly(class_basename($this->argument('name')));
|
||||
$factory = Str::studly($this->argument('name'));
|
||||
|
||||
$this->call('make:factory', [
|
||||
'name' => "{$factory}Factory",
|
||||
@@ -108,7 +116,7 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
{
|
||||
$seeder = Str::studly(class_basename($this->argument('name')));
|
||||
|
||||
$this->call('make:seed', [
|
||||
$this->call('make:seeder', [
|
||||
'name' => "{$seeder}Seeder",
|
||||
]);
|
||||
}
|
||||
@@ -125,12 +133,28 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
$modelName = $this->qualifyClass($this->getNameInput());
|
||||
|
||||
$this->call('make:controller', array_filter([
|
||||
'name' => "{$controller}Controller",
|
||||
'name' => "{$controller}Controller",
|
||||
'--model' => $this->option('resource') || $this->option('api') ? $modelName : null,
|
||||
'--api' => $this->option('api'),
|
||||
'--requests' => $this->option('requests') || $this->option('all'),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a policy file for the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function createPolicy()
|
||||
{
|
||||
$policy = Str::studly(class_basename($this->argument('name')));
|
||||
|
||||
$this->call('make:policy', [
|
||||
'name' => "{$policy}Policy",
|
||||
'--model' => $this->qualifyClass($this->getNameInput()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
@@ -156,6 +180,17 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return is_dir(app_path('Models')) ? $rootNamespace.'\\Models' : $rootNamespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
@@ -164,15 +199,17 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, and resource controller for the model'],
|
||||
['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, and resource controller for the model'],
|
||||
['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'],
|
||||
['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'],
|
||||
['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'],
|
||||
['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'],
|
||||
['seed', 's', InputOption::VALUE_NONE, 'Create a new seeder file for the model'],
|
||||
['policy', null, InputOption::VALUE_NONE, 'Create a new policy for the model'],
|
||||
['seed', 's', InputOption::VALUE_NONE, 'Create a new seeder for the model'],
|
||||
['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'],
|
||||
['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'],
|
||||
['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API controller'],
|
||||
['requests', 'R', InputOption::VALUE_NONE, 'Create new form request classes and use them in the resource controller'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Concerns\CreatesMatchingTest;
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class NotificationMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use CreatesMatchingTest;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
@@ -73,7 +76,7 @@ class NotificationMakeCommand extends GeneratorCommand
|
||||
$class = parent::buildClass($name);
|
||||
|
||||
if ($this->option('markdown')) {
|
||||
$class = str_replace('DummyView', $this->option('markdown'), $class);
|
||||
$class = str_replace(['DummyView', '{{ view }}'], $this->option('markdown'), $class);
|
||||
}
|
||||
|
||||
return $class;
|
||||
@@ -87,8 +90,21 @@ class NotificationMakeCommand extends GeneratorCommand
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('markdown')
|
||||
? __DIR__.'/stubs/markdown-notification.stub'
|
||||
: __DIR__.'/stubs/notification.stub';
|
||||
? $this->resolveStubPath('/stubs/markdown-notification.stub')
|
||||
: $this->resolveStubPath('/stubs/notification.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ObserverMakeCommand extends GeneratorCommand
|
||||
@@ -44,18 +44,6 @@ class ObserverMakeCommand extends GeneratorCommand
|
||||
return $model ? $this->replaceModel($stub, $model) : $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('model')
|
||||
? __DIR__.'/stubs/observer.stub'
|
||||
: __DIR__.'/stubs/observer.plain.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the model for the given stub.
|
||||
*
|
||||
@@ -65,27 +53,65 @@ class ObserverMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function replaceModel($stub, $model)
|
||||
{
|
||||
$model = str_replace('/', '\\', $model);
|
||||
$modelClass = $this->parseModel($model);
|
||||
|
||||
$namespaceModel = $this->laravel->getNamespace().$model;
|
||||
$replace = [
|
||||
'DummyFullModelClass' => $modelClass,
|
||||
'{{ namespacedModel }}' => $modelClass,
|
||||
'{{namespacedModel}}' => $modelClass,
|
||||
'DummyModelClass' => class_basename($modelClass),
|
||||
'{{ model }}' => class_basename($modelClass),
|
||||
'{{model}}' => class_basename($modelClass),
|
||||
'DummyModelVariable' => lcfirst(class_basename($modelClass)),
|
||||
'{{ modelVariable }}' => lcfirst(class_basename($modelClass)),
|
||||
'{{modelVariable}}' => lcfirst(class_basename($modelClass)),
|
||||
];
|
||||
|
||||
if (Str::startsWith($model, '\\')) {
|
||||
$stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
|
||||
} else {
|
||||
$stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
|
||||
return str_replace(
|
||||
array_keys($replace), array_values($replace), $stub
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fully-qualified model class name.
|
||||
*
|
||||
* @param string $model
|
||||
* @return string
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseModel($model)
|
||||
{
|
||||
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
|
||||
throw new InvalidArgumentException('Model name contains invalid characters.');
|
||||
}
|
||||
|
||||
$stub = str_replace(
|
||||
"use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
|
||||
);
|
||||
return $this->qualifyModel($model);
|
||||
}
|
||||
|
||||
$model = class_basename(trim($model, '\\'));
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('model')
|
||||
? $this->resolveStubPath('/stubs/observer.stub')
|
||||
: $this->resolveStubPath('/stubs/observer.plain.stub');
|
||||
}
|
||||
|
||||
$stub = str_replace('DocDummyModel', Str::snake($model, ' '), $stub);
|
||||
|
||||
$stub = str_replace('DummyModel', $model, $stub);
|
||||
|
||||
return str_replace('dummyModel', Str::camel($model), $stub);
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ class OptimizeClearCommand extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->call('event:clear');
|
||||
$this->call('view:clear');
|
||||
$this->call('cache:clear');
|
||||
$this->call('route:clear');
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use LogicException;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class PolicyMakeCommand extends GeneratorCommand
|
||||
@@ -71,6 +72,8 @@ class PolicyMakeCommand extends GeneratorCommand
|
||||
* Get the model for the guard's user provider.
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function userProviderModel()
|
||||
{
|
||||
@@ -78,8 +81,16 @@ class PolicyMakeCommand extends GeneratorCommand
|
||||
|
||||
$guard = $this->option('guard') ?: $config->get('auth.defaults.guard');
|
||||
|
||||
if (is_null($guardProvider = $config->get('auth.guards.'.$guard.'.provider'))) {
|
||||
throw new LogicException('The ['.$guard.'] guard is not defined in your "auth" configuration file.');
|
||||
}
|
||||
|
||||
if (! $config->get('auth.providers.'.$guardProvider.'.model')) {
|
||||
return 'App\\Models\\User';
|
||||
}
|
||||
|
||||
return $config->get(
|
||||
'auth.providers.'.$config->get('auth.guards.'.$guard.'.provider').'.model'
|
||||
'auth.providers.'.$guardProvider.'.model'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,7 +108,7 @@ class PolicyMakeCommand extends GeneratorCommand
|
||||
if (Str::startsWith($model, '\\')) {
|
||||
$namespacedModel = trim($model, '\\');
|
||||
} else {
|
||||
$namespacedModel = $this->laravel->getNamespace().$model;
|
||||
$namespacedModel = $this->qualifyModel($model);
|
||||
}
|
||||
|
||||
$model = class_basename(trim($model, '\\'));
|
||||
@@ -126,8 +137,13 @@ class PolicyMakeCommand extends GeneratorCommand
|
||||
array_keys($replace), array_values($replace), $stub
|
||||
);
|
||||
|
||||
return str_replace(
|
||||
"use {$namespacedModel};\nuse {$namespacedModel};", "use {$namespacedModel};", $stub
|
||||
return preg_replace(
|
||||
vsprintf('/use %s;[\r\n]+use %s;/', [
|
||||
preg_quote($namespacedModel, '/'),
|
||||
preg_quote($namespacedModel, '/'),
|
||||
]),
|
||||
"use {$namespacedModel};",
|
||||
$stub
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,20 @@ class ProviderMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/provider.stub';
|
||||
return $this->resolveStubPath('/stubs/provider.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__.$stub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,14 +36,14 @@ class RouteListCommand extends Command
|
||||
/**
|
||||
* The table headers for the command.
|
||||
*
|
||||
* @var array
|
||||
* @var string[]
|
||||
*/
|
||||
protected $headers = ['Domain', 'Method', 'URI', 'Name', 'Action', 'Middleware'];
|
||||
|
||||
/**
|
||||
* The columns to display when using the "compact" flag.
|
||||
*
|
||||
* @var array
|
||||
* @var string[]
|
||||
*/
|
||||
protected $compactColumns = ['method', 'uri', 'action'];
|
||||
|
||||
@@ -67,6 +67,8 @@ class RouteListCommand extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->router->flushMiddlewareGroups();
|
||||
|
||||
if (empty($this->router->getRoutes())) {
|
||||
return $this->error("Your application doesn't have any routes.");
|
||||
}
|
||||
@@ -89,7 +91,7 @@ class RouteListCommand extends Command
|
||||
return $this->getRouteInformation($route);
|
||||
})->filter()->all();
|
||||
|
||||
if ($sort = $this->option('sort')) {
|
||||
if (($sort = $this->option('sort')) !== 'precedence') {
|
||||
$routes = $this->sortRoutes($sort, $routes);
|
||||
}
|
||||
|
||||
@@ -111,8 +113,8 @@ class RouteListCommand extends Command
|
||||
return $this->filterRoute([
|
||||
'domain' => $route->domain(),
|
||||
'method' => implode('|', $route->methods()),
|
||||
'uri' => $route->uri(),
|
||||
'name' => $route->getName(),
|
||||
'uri' => $route->uri(),
|
||||
'name' => $route->getName(),
|
||||
'action' => ltrim($route->getActionName(), '\\'),
|
||||
'middleware' => $this->getMiddleware($route),
|
||||
]);
|
||||
@@ -154,7 +156,7 @@ class RouteListCommand extends Command
|
||||
protected function displayRoutes(array $routes)
|
||||
{
|
||||
if ($this->option('json')) {
|
||||
$this->line(json_encode(array_values($routes)));
|
||||
$this->line($this->asJson($routes));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -163,7 +165,7 @@ class RouteListCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Get before filters.
|
||||
* Get the middleware for the route.
|
||||
*
|
||||
* @param \Illuminate\Routing\Route $route
|
||||
* @return string
|
||||
@@ -189,6 +191,14 @@ class RouteListCommand extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->option('except-path')) {
|
||||
foreach (explode(',', $this->option('except-path')) as $path) {
|
||||
if (Str::contains($route['uri'], $path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
@@ -243,6 +253,24 @@ class RouteListCommand extends Command
|
||||
return array_map('strtolower', $results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given routes to JSON.
|
||||
*
|
||||
* @param array $routes
|
||||
* @return string
|
||||
*/
|
||||
protected function asJson(array $routes)
|
||||
{
|
||||
return collect($routes)
|
||||
->map(function ($route) {
|
||||
$route['middleware'] = empty($route['middleware']) ? [] : explode("\n", $route['middleware']);
|
||||
|
||||
return $route;
|
||||
})
|
||||
->values()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
@@ -256,9 +284,10 @@ class RouteListCommand extends Command
|
||||
['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'],
|
||||
['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'],
|
||||
['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path'],
|
||||
['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'],
|
||||
['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'],
|
||||
['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'],
|
||||
['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'],
|
||||
['sort', null, InputOption::VALUE_OPTIONAL, 'The column (precedence, domain, method, uri, name, action, middleware) to sort by', 'uri'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class RuleMakeCommand extends GeneratorCommand
|
||||
{
|
||||
@@ -27,6 +28,23 @@ class RuleMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected $type = 'Rule';
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
{
|
||||
return str_replace(
|
||||
'{{ ruleType }}',
|
||||
$this->option('implicit') ? 'ImplicitRule' : 'Rule',
|
||||
parent::buildClass($name)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
@@ -51,4 +69,16 @@ class RuleMakeCommand extends GeneratorCommand
|
||||
{
|
||||
return $rootNamespace.'\Rules';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['implicit', 'i', InputOption::VALUE_NONE, 'Generate an implicit rule.'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Env;
|
||||
use Illuminate\Support\ProcessUtils;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class ServeCommand extends Command
|
||||
{
|
||||
@@ -42,9 +42,41 @@ class ServeCommand extends Command
|
||||
{
|
||||
chdir(public_path());
|
||||
|
||||
$this->line("<info>Laravel development server started:</info> http://{$this->host()}:{$this->port()}");
|
||||
$this->line("<info>Starting Laravel development server:</info> http://{$this->host()}:{$this->port()}");
|
||||
|
||||
passthru($this->serverCommand(), $status);
|
||||
$environmentFile = $this->option('env')
|
||||
? base_path('.env').'.'.$this->option('env')
|
||||
: base_path('.env');
|
||||
|
||||
$hasEnvironment = file_exists($environmentFile);
|
||||
|
||||
$environmentLastModified = $hasEnvironment
|
||||
? filemtime($environmentFile)
|
||||
: now()->addDays(30)->getTimestamp();
|
||||
|
||||
$process = $this->startProcess($hasEnvironment);
|
||||
|
||||
while ($process->isRunning()) {
|
||||
if ($hasEnvironment) {
|
||||
clearstatcache(false, $environmentFile);
|
||||
}
|
||||
|
||||
if (! $this->option('no-reload') &&
|
||||
$hasEnvironment &&
|
||||
filemtime($environmentFile) > $environmentLastModified) {
|
||||
$environmentLastModified = filemtime($environmentFile);
|
||||
|
||||
$this->comment('Environment modified. Restarting server...');
|
||||
|
||||
$process->stop(5);
|
||||
|
||||
$process = $this->startProcess($hasEnvironment);
|
||||
}
|
||||
|
||||
usleep(500 * 1000);
|
||||
}
|
||||
|
||||
$status = $process->getExitCode();
|
||||
|
||||
if ($status && $this->canTryAnotherPort()) {
|
||||
$this->portOffset += 1;
|
||||
@@ -55,19 +87,51 @@ class ServeCommand extends Command
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a new server process.
|
||||
*
|
||||
* @param bool $hasEnvironment
|
||||
* @return \Symfony\Component\Process\Process
|
||||
*/
|
||||
protected function startProcess($hasEnvironment)
|
||||
{
|
||||
$process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) {
|
||||
if ($this->option('no-reload') || ! $hasEnvironment) {
|
||||
return [$key => $value];
|
||||
}
|
||||
|
||||
return in_array($key, [
|
||||
'APP_ENV',
|
||||
'LARAVEL_SAIL',
|
||||
'PHP_CLI_SERVER_WORKERS',
|
||||
'PHP_IDE_CONFIG',
|
||||
'SYSTEMROOT',
|
||||
'XDEBUG_CONFIG',
|
||||
'XDEBUG_MODE',
|
||||
'XDEBUG_SESSION',
|
||||
]) ? [$key => $value] : [$key => false];
|
||||
})->all());
|
||||
|
||||
$process->start(function ($type, $buffer) {
|
||||
$this->output->write($buffer);
|
||||
});
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full server command.
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
protected function serverCommand()
|
||||
{
|
||||
return sprintf('%s -S %s:%s %s',
|
||||
ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
|
||||
$this->host(),
|
||||
$this->port(),
|
||||
ProcessUtils::escapeArgument(base_path('server.php'))
|
||||
);
|
||||
return [
|
||||
(new PhpExecutableFinder)->find(false),
|
||||
'-S',
|
||||
$this->host().':'.$this->port(),
|
||||
base_path('server.php'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +141,9 @@ class ServeCommand extends Command
|
||||
*/
|
||||
protected function host()
|
||||
{
|
||||
return $this->input->getOption('host');
|
||||
[$host, ] = $this->getHostAndPort();
|
||||
|
||||
return $host;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,13 +153,34 @@ class ServeCommand extends Command
|
||||
*/
|
||||
protected function port()
|
||||
{
|
||||
$port = $this->input->getOption('port') ?: 8000;
|
||||
$port = $this->input->getOption('port');
|
||||
|
||||
if (is_null($port)) {
|
||||
[, $port] = $this->getHostAndPort();
|
||||
}
|
||||
|
||||
$port = $port ?: 8000;
|
||||
|
||||
return $port + $this->portOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if command has reached its max amount of port tries.
|
||||
* Get the host and port from the host option string.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getHostAndPort()
|
||||
{
|
||||
$hostParts = explode(':', $this->input->getOption('host'));
|
||||
|
||||
return [
|
||||
$hostParts[0],
|
||||
$hostParts[1] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the command has reached its max amount of port tries.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -112,10 +199,9 @@ class ServeCommand extends Command
|
||||
{
|
||||
return [
|
||||
['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'],
|
||||
|
||||
['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')],
|
||||
|
||||
['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10],
|
||||
['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
|
||||
|
||||
class StorageLinkCommand extends Command
|
||||
{
|
||||
@@ -13,7 +11,9 @@ class StorageLinkCommand extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'storage:link {--relative : Create the symbolic link using relative paths}';
|
||||
protected $signature = 'storage:link
|
||||
{--relative : Create the symbolic link using relative paths}
|
||||
{--force : Recreate existing symbolic links}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -29,18 +29,25 @@ class StorageLinkCommand extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$relative = $this->option('relative');
|
||||
|
||||
foreach ($this->links() as $link => $target) {
|
||||
if (file_exists($link)) {
|
||||
if (file_exists($link) && ! $this->isRemovableSymlink($link, $this->option('force'))) {
|
||||
$this->error("The [$link] link already exists.");
|
||||
} else {
|
||||
if ($this->option('relative')) {
|
||||
$target = $this->getRelativeTarget($link, $target);
|
||||
}
|
||||
|
||||
$this->laravel->make('files')->link($target, $link);
|
||||
|
||||
$this->info("The [$link] link has been connected to [$target].");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_link($link)) {
|
||||
$this->laravel->make('files')->delete($link);
|
||||
}
|
||||
|
||||
if ($relative) {
|
||||
$this->laravel->make('files')->relativeLink($target, $link);
|
||||
} else {
|
||||
$this->laravel->make('files')->link($target, $link);
|
||||
}
|
||||
|
||||
$this->info("The [$link] link has been connected to [$target].");
|
||||
}
|
||||
|
||||
$this->info('The links have been created.');
|
||||
@@ -58,18 +65,14 @@ class StorageLinkCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the relative path to the target.
|
||||
* Determine if the provided path is a symlink that can be removed.
|
||||
*
|
||||
* @param string $link
|
||||
* @param string $target
|
||||
* @return string
|
||||
* @param bool $force
|
||||
* @return bool
|
||||
*/
|
||||
protected function getRelativeTarget($link, $target)
|
||||
protected function isRemovableSymlink(string $link, bool $force): bool
|
||||
{
|
||||
if (! class_exists(SymfonyFilesystem::class)) {
|
||||
throw new RuntimeException('To enable support for relative links, please install the symfony/filesystem package.');
|
||||
}
|
||||
|
||||
return (new SymfonyFilesystem)->makePathRelative($target, dirname($link));
|
||||
return is_link($link) && $force;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,24 +33,34 @@ class StubPublishCommand extends Command
|
||||
}
|
||||
|
||||
$files = [
|
||||
__DIR__.'/stubs/cast.stub' => $stubsPath.'/cast.stub',
|
||||
__DIR__.'/stubs/console.stub' => $stubsPath.'/console.stub',
|
||||
__DIR__.'/stubs/event.stub' => $stubsPath.'/event.stub',
|
||||
__DIR__.'/stubs/job.queued.stub' => $stubsPath.'/job.queued.stub',
|
||||
__DIR__.'/stubs/job.stub' => $stubsPath.'/job.stub',
|
||||
__DIR__.'/stubs/mail.stub' => $stubsPath.'/mail.stub',
|
||||
__DIR__.'/stubs/markdown-mail.stub' => $stubsPath.'/markdown-mail.stub',
|
||||
__DIR__.'/stubs/markdown-notification.stub' => $stubsPath.'/markdown-notification.stub',
|
||||
__DIR__.'/stubs/model.pivot.stub' => $stubsPath.'/model.pivot.stub',
|
||||
__DIR__.'/stubs/model.stub' => $stubsPath.'/model.stub',
|
||||
__DIR__.'/stubs/notification.stub' => $stubsPath.'/notification.stub',
|
||||
__DIR__.'/stubs/observer.plain.stub' => $stubsPath.'/observer.plain.stub',
|
||||
__DIR__.'/stubs/observer.stub' => $stubsPath.'/observer.stub',
|
||||
__DIR__.'/stubs/policy.plain.stub' => $stubsPath.'/policy.plain.stub',
|
||||
__DIR__.'/stubs/policy.stub' => $stubsPath.'/policy.stub',
|
||||
__DIR__.'/stubs/provider.stub' => $stubsPath.'/provider.stub',
|
||||
__DIR__.'/stubs/request.stub' => $stubsPath.'/request.stub',
|
||||
__DIR__.'/stubs/resource.stub' => $stubsPath.'/resource.stub',
|
||||
__DIR__.'/stubs/resource-collection.stub' => $stubsPath.'/resource-collection.stub',
|
||||
__DIR__.'/stubs/resource.stub' => $stubsPath.'/resource.stub',
|
||||
__DIR__.'/stubs/rule.stub' => $stubsPath.'/rule.stub',
|
||||
__DIR__.'/stubs/test.stub' => $stubsPath.'/test.stub',
|
||||
__DIR__.'/stubs/test.unit.stub' => $stubsPath.'/test.unit.stub',
|
||||
__DIR__.'/stubs/view-component.stub' => $stubsPath.'/view-component.stub',
|
||||
realpath(__DIR__.'/../../Database/Console/Factories/stubs/factory.stub') => $stubsPath.'/factory.stub',
|
||||
realpath(__DIR__.'/../../Database/Console/Seeds/stubs/seeder.stub') => $stubsPath.'/seeder.stub',
|
||||
realpath(__DIR__.'/../../Database/Migrations/stubs/migration.create.stub') => $stubsPath.'/migration.create.stub',
|
||||
realpath(__DIR__.'/../../Database/Migrations/stubs/migration.stub') => $stubsPath.'/migration.stub',
|
||||
realpath(__DIR__.'/../../Database/Migrations/stubs/migration.update.stub') => $stubsPath.'/migration.update.stub',
|
||||
realpath(__DIR__.'/../../Foundation/Console/stubs/console.stub') => $stubsPath.'/console.stub',
|
||||
realpath(__DIR__.'/../../Foundation/Console/stubs/policy.plain.stub') => $stubsPath.'/policy.plain.stub',
|
||||
realpath(__DIR__.'/../../Foundation/Console/stubs/policy.stub') => $stubsPath.'/policy.stub',
|
||||
realpath(__DIR__.'/../../Foundation/Console/stubs/rule.stub') => $stubsPath.'/rule.stub',
|
||||
realpath(__DIR__.'/../../Routing/Console/stubs/controller.api.stub') => $stubsPath.'/controller.api.stub',
|
||||
realpath(__DIR__.'/../../Routing/Console/stubs/controller.invokable.stub') => $stubsPath.'/controller.invokable.stub',
|
||||
realpath(__DIR__.'/../../Routing/Console/stubs/controller.model.api.stub') => $stubsPath.'/controller.model.api.stub',
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class TestMakeCommand extends GeneratorCommand
|
||||
{
|
||||
@@ -12,7 +13,7 @@ class TestMakeCommand extends GeneratorCommand
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'make:test {name : The name of the class} {--unit : Create a unit test}';
|
||||
protected $name = 'make:test';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -35,9 +36,11 @@ class TestMakeCommand extends GeneratorCommand
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('unit')
|
||||
? $this->resolveStubPath('/stubs/test.unit.stub')
|
||||
: $this->resolveStubPath('/stubs/test.stub');
|
||||
$suffix = $this->option('unit') ? '.unit.stub' : '.stub';
|
||||
|
||||
return $this->option('pest')
|
||||
? $this->resolveStubPath('/stubs/pest'.$suffix)
|
||||
: $this->resolveStubPath('/stubs/test'.$suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,4 +93,17 @@ class TestMakeCommand extends GeneratorCommand
|
||||
{
|
||||
return 'Tests';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test.'],
|
||||
['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test.'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Events\MaintenanceModeDisabled;
|
||||
|
||||
class UpCommand extends Command
|
||||
{
|
||||
@@ -29,14 +30,20 @@ class UpCommand extends Command
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
if (! file_exists(storage_path('framework/down'))) {
|
||||
if (! is_file(storage_path('framework/down'))) {
|
||||
$this->comment('Application is already up.');
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unlink(storage_path('framework/down'));
|
||||
|
||||
if (is_file(storage_path('framework/maintenance.php'))) {
|
||||
unlink(storage_path('framework/maintenance.php'));
|
||||
}
|
||||
|
||||
$this->laravel->get('events')->dispatch(MaintenanceModeDisabled::class);
|
||||
|
||||
$this->info('Application is now live.');
|
||||
} catch (Exception $e) {
|
||||
$this->error('Failed to disable maintenance mode.');
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Foundation\Events\VendorTagPublished;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use League\Flysystem\Adapter\Local as LocalAdapter;
|
||||
@@ -159,14 +160,18 @@ class VendorPublishCommand extends Command
|
||||
{
|
||||
$published = false;
|
||||
|
||||
foreach ($this->pathsToPublish($tag) as $from => $to) {
|
||||
$pathsToPublish = $this->pathsToPublish($tag);
|
||||
|
||||
foreach ($pathsToPublish as $from => $to) {
|
||||
$this->publishItem($from, $to);
|
||||
|
||||
$published = true;
|
||||
}
|
||||
|
||||
if ($published === false) {
|
||||
$this->error('Unable to locate publishable resources.');
|
||||
$this->comment('No publishable resources for tag ['.$tag.'].');
|
||||
} else {
|
||||
$this->laravel['events']->dispatch(new VendorTagPublished($tag, $pathsToPublish));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||
|
||||
class DummyClass implements CastsAttributes
|
||||
class {{ class }} implements CastsAttributes
|
||||
{
|
||||
/**
|
||||
* Cast the given value.
|
||||
@@ -15,7 +15,7 @@ class DummyClass implements CastsAttributes
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($model, $key, $value, $attributes)
|
||||
public function get($model, string $key, $value, array $attributes)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
@@ -25,11 +25,11 @@ class DummyClass implements CastsAttributes
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $key
|
||||
* @param array $value
|
||||
* @param mixed $value
|
||||
* @param array $attributes
|
||||
* @return mixed
|
||||
*/
|
||||
public function set($model, $key, $value, $attributes)
|
||||
public function set($model, string $key, $value, array $attributes)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use NamespacedDummyUserModel;
|
||||
use {{ namespacedUserModel }};
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
/**
|
||||
* Create a new channel instance.
|
||||
@@ -19,10 +19,10 @@ class DummyClass
|
||||
/**
|
||||
* Authenticate the user's access to the channel.
|
||||
*
|
||||
* @param \NamespacedDummyUserModel $user
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @return array|bool
|
||||
*/
|
||||
public function join(DummyUser $user)
|
||||
public function join({{ userModel }} $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
@@ -10,7 +10,7 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Exception;
|
||||
|
||||
class DummyClass extends Exception
|
||||
class {{ class }} extends Exception
|
||||
{
|
||||
/**
|
||||
* Report the exception.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Exception;
|
||||
|
||||
class DummyClass extends Exception
|
||||
class {{ class }} extends Exception
|
||||
{
|
||||
/**
|
||||
* Render the exception as an HTTP response.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Exception;
|
||||
|
||||
class DummyClass extends Exception
|
||||
class {{ class }} extends Exception
|
||||
{
|
||||
/**
|
||||
* Report the exception.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Exception;
|
||||
|
||||
class DummyClass extends Exception
|
||||
class {{ class }} extends Exception
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class DummyClass implements ShouldQueue
|
||||
class {{ class }} implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use DummyFullEvent;
|
||||
use {{ eventNamespace }};
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class DummyClass implements ShouldQueue
|
||||
class {{ class }} implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
@@ -23,10 +23,10 @@ class DummyClass implements ShouldQueue
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param DummyEvent $event
|
||||
* @param {{ eventNamespace }} $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(DummyEvent $event)
|
||||
public function handle({{ event }} $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use DummyFullEvent;
|
||||
use {{ eventNamespace }};
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
@@ -21,10 +21,10 @@ class DummyClass
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param DummyEvent $event
|
||||
* @param \{{ eventNamespace }} $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(DummyEvent $event)
|
||||
public function handle({{ event }} $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DummyClass extends Mailable
|
||||
class {{ class }} extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DummyClass extends Mailable
|
||||
class {{ class }} extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
@@ -28,6 +28,6 @@ class DummyClass extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->markdown('DummyView');
|
||||
return $this->markdown('{{ view }}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class DummyClass extends Notification
|
||||
class {{ class }} extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -40,7 +40,7 @@ class DummyClass extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)->markdown('DummyView');
|
||||
return (new MailMessage)->markdown('{{ view }}');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class {{ class }} extends Model
|
||||
{
|
||||
//
|
||||
use HasFactory;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class DummyClass extends Notification
|
||||
class {{ class }} extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use NamespacedDummyModel;
|
||||
use {{ namespacedModel }};
|
||||
|
||||
class DummyClass
|
||||
class {{ class }}
|
||||
{
|
||||
/**
|
||||
* Handle the DocDummyModel "created" event.
|
||||
* Handle the {{ model }} "created" event.
|
||||
*
|
||||
* @param \NamespacedDummyModel $dummyModel
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return void
|
||||
*/
|
||||
public function created(DummyModel $dummyModel)
|
||||
public function created({{ model }} ${{ modelVariable }})
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the DocDummyModel "updated" event.
|
||||
* Handle the {{ model }} "updated" event.
|
||||
*
|
||||
* @param \NamespacedDummyModel $dummyModel
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return void
|
||||
*/
|
||||
public function updated(DummyModel $dummyModel)
|
||||
public function updated({{ model }} ${{ modelVariable }})
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the DocDummyModel "deleted" event.
|
||||
* Handle the {{ model }} "deleted" event.
|
||||
*
|
||||
* @param \NamespacedDummyModel $dummyModel
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(DummyModel $dummyModel)
|
||||
public function deleted({{ model }} ${{ modelVariable }})
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the DocDummyModel "restored" event.
|
||||
* Handle the {{ model }} "restored" event.
|
||||
*
|
||||
* @param \NamespacedDummyModel $dummyModel
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return void
|
||||
*/
|
||||
public function restored(DummyModel $dummyModel)
|
||||
public function restored({{ model }} ${{ modelVariable }})
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the DocDummyModel "force deleted" event.
|
||||
* Handle the {{ model }} "force deleted" event.
|
||||
*
|
||||
* @param \NamespacedDummyModel $dummyModel
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return void
|
||||
*/
|
||||
public function forceDeleted(DummyModel $dummyModel)
|
||||
public function forceDeleted({{ model }} ${{ modelVariable }})
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class {{ class }}
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function viewAny({{ user }} $user)
|
||||
{
|
||||
@@ -26,7 +26,7 @@ class {{ class }}
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function view({{ user }} $user, {{ model }} ${{ modelVariable }})
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class {{ class }}
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function create({{ user }} $user)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ class {{ class }}
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update({{ user }} $user, {{ model }} ${{ modelVariable }})
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class {{ class }}
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function delete({{ user }} $user, {{ model }} ${{ modelVariable }})
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class {{ class }}
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function restore({{ user }} $user, {{ model }} ${{ modelVariable }})
|
||||
{
|
||||
@@ -85,7 +85,7 @@ class {{ class }}
|
||||
*
|
||||
* @param \{{ namespacedUserModel }} $user
|
||||
* @param \{{ namespacedModel }} ${{ modelVariable }}
|
||||
* @return mixed
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function forceDelete({{ user }} $user, {{ model }} ${{ modelVariable }})
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DummyClass extends ServiceProvider
|
||||
class {{ class }} extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
|
||||
@@ -10,7 +10,7 @@ class {{ class }} extends ResourceCollection
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ class {{ class }} extends JsonResource
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Illuminate\Contracts\Validation\{{ ruleType }};
|
||||
|
||||
class {{ class }} implements Rule
|
||||
class {{ class }} implements {{ ruleType }}
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
|
||||
@@ -13,7 +13,7 @@ class {{ class }} extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
public function test_example()
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class {{ class }} extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
public function test_example()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class DummyClass extends Component
|
||||
class {{ class }} extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
@@ -19,10 +19,10 @@ class DummyClass extends Component
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\View\View|string
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return DummyView;
|
||||
return {{ view }};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user