EventMakeCommand
class EventMakeCommand extends GeneratorCommand
Traits
Properties
| protected Factory|null | $components | The console components factory. |
from InteractsWithIO |
| protected InputInterface|null | $input | from InteractsWithIO | |
| protected OutputStyle|null | $output | from InteractsWithIO | |
| protected int | $verbosity | The default verbosity of output commands. |
from InteractsWithIO |
| protected array | $verbosityMap | The mapping between human readable verbosity levels and Symfony's OutputInterface. |
from InteractsWithIO |
| protected SignalRegistry|null | $signalRegistry | from InteractsWithSignals | |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string|null | $signature | The name and signature of the console command. |
from Command |
| protected string|null | $name | The console command name. |
|
| protected string | $description | The console command description. |
|
| protected string | $help | The console command help text. |
from Command |
| $hidden | Indicates whether the command should be shown in the Artisan command list. |
from Command | |
| protected bool | $isolated | Indicates whether only one instance of the command can run at any given time. |
from Command |
| protected int | $isolatedExitCode | The default exit code for isolated commands. |
from Command |
| protected string[] | $aliases | The console command name aliases. |
from Command |
| protected bool | $coroutine | Whether to execute in a coroutine environment. |
from GeneratorCommand |
| protected Dispatcher|null | $eventDispatcher | The event dispatcher instance. |
from Command |
| protected int | $hookFlags | The hook flags for the coroutine. |
from Command |
| protected int | $exitCode | The exit code of the command. |
from Command |
| protected Application|null | $hypervel | The Hypervel application instance. |
from Command |
| protected Filesystem | $files | The filesystem instance. |
from GeneratorCommand |
| protected string | $type | The type of class being generated. |
|
| protected string[] | $reservedNames | Reserved names that cannot be used for generation. |
from GeneratorCommand |
Methods
Resolve the console command instance for the given command.
Call another console command.
Call another console command without output.
Call another console command without output.
Run the given console command.
Create an input instance from the given arguments.
Prompt the user until the given validation callback passes.
Validate the given prompt value using the validator.
Get the validator instance that should be used to validate prompts.
Get the validation messages that should be used during prompt validation.
Get the validation attributes that should be used during prompt validation.
Add the disable event dispatcher option to the command.
Disable or enable the event dispatcher based on the input option.
Get the console command options.
Retrieve the command's input as a CommandInput instance or retrieve an input item.
Confirm a question with the user.
Prompt the user for input.
Prompt the user for input with auto completion.
Prompt the user for input with auto completion.
Prompt the user for input but hide the answer from the console.
Give the user a single choice from an array of answers.
Format input to textual table.
Execute a given callback while advancing a progress bar.
Write a string as information output.
Write a string as standard output.
Write a string as comment output.
Write a string as question output.
Write a string as error output.
Write a string as warning output.
Write a string in an alert box.
Get the output component factory implementation.
Get the verbosity level in terms of Symfony's OutputInterface level.
Define a callback to be run when the given signal(s) occurs.
Unregister signal handlers for one, many, or all signals.
Interact with the user before validating the input.
Prompt the user for any missing arguments.
Prompt for missing input arguments using the returned questions.
Perform actions after the user was prompted for missing arguments.
Determine whether the input contains any options that differ from the default values.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Configure usage examples for the command from class attributes.
Configure the console command using a fluent definition.
Get a command isolation mutex instance for the command.
Set up the traits used by the command.
Add the --target-path and --target-namespace options to the command definition.
Get the stub file for the generator.
Parse the class name and format according to the root namespace.
Get the default namespace for the class.
Determine if the class already exists.
Build the directory for the class if necessary.
Replace a generated file while preserving its permissions.
Replace the namespace for the given stub.
Get the full namespace for a given class, without the class name.
Replace the class name for the given stub.
Alphabetically sort the imports for the given stub.
Get the model for the default guard's user provider.
Get the first view directory path from the application configuration.
Resolve the fully-qualified path to the stub.
Details
in
CallsCommands at line 18
abstract protected Command
resolveCommand(Command|string $command)
Resolve the console command instance for the given command.
in
CallsCommands at line 23
int
call(Command|string $command, array $arguments = [])
Call another console command.
in
CallsCommands at line 31
int
callSilent(Command|string $command, array $arguments = [])
Call another console command without output.
in
CallsCommands at line 39
int
callSilently(Command|string $command, array $arguments = [])
Call another console command without output.
in
CallsCommands at line 47
protected int
runCommand(Command|string $command, array $arguments, OutputInterface $output)
Run the given console command.
in
CallsCommands at line 64
protected ArrayInput
createInputFromArguments(array $arguments)
Create an input instance from the given arguments.
in
CallsCommands at line 78
protected array
context()
Get all the context passed to the command.
in
ConfiguresPrompts at line 32
protected void
configurePrompts(InputInterface $input)
Configure the prompt fallbacks.
in
ConfiguresPrompts at line 149
protected PResult
promptUntilValid(PResult $prompt, bool|string $required, null|PResult): mixed $validate)
Prompt the user until the given validation callback passes.
in
ConfiguresPrompts at line 185
protected ?string
validatePrompt(mixed $value, mixed $rules)
Validate the given prompt value using the validator.
in
ConfiguresPrompts at line 220
protected Validator
getPromptValidatorInstance(mixed $field, mixed $value, mixed $rules, array $messages = [], array $attributes = [])
Get the validator instance that should be used to validate prompts.
in
ConfiguresPrompts at line 235
protected array
validationMessages()
Get the validation messages that should be used during prompt validation.
in
ConfiguresPrompts at line 245
protected array
validationAttributes()
Get the validation attributes that should be used during prompt validation.
in
DisableEventDispatcher at line 17
void
addDisableDispatcherOption()
Add the disable event dispatcher option to the command.
in
DisableEventDispatcher at line 25
void
disableDispatcher(InputInterface $input)
Disable or enable the event dispatcher based on the input option.
in
HasParameters at line 15
protected void
specifyParameters()
Specify the arguments and options on the command.
in
HasParameters at line 40
protected array
getArguments()
Get the console command arguments.
at line 67
protected array
getOptions()
Get the console command options.
in
InteractsWithIO at line 53
mixed
input(string|null $key = null, mixed $default = null)
Retrieve the command's input as a CommandInput instance or retrieve an input item.
in
InteractsWithIO at line 63
bool
hasArgument(int|string $name)
Determine if the given argument is present.
in
InteractsWithIO at line 71
mixed
argument(string|null $key = null)
Get the value of a command argument.
in
InteractsWithIO at line 83
array
arguments()
Get all of the arguments passed to the command.
in
InteractsWithIO at line 91
bool
hasOption(string $name)
Determine if the given option is present.
in
InteractsWithIO at line 99
mixed
option(string|null $key = null)
Get the value of a command option.
in
InteractsWithIO at line 111
array
options()
Get all of the options passed to the command.
in
InteractsWithIO at line 119
bool
confirm(string $question, bool $default = false)
Confirm a question with the user.
in
InteractsWithIO at line 127
mixed
ask(string $question, string|null $default = null)
Prompt the user for input.
in
InteractsWithIO at line 135
mixed
anticipate(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
in
InteractsWithIO at line 143
mixed
askWithCompletion(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
in
InteractsWithIO at line 157
mixed
secret(string $question, bool $fallback = true)
Prompt the user for input but hide the answer from the console.
in
InteractsWithIO at line 169
array|string
choice(string $question, array $choices, int|string|null $default = null, int|null $attempts = null, bool $multiple = false)
Give the user a single choice from an array of answers.
in
InteractsWithIO at line 181
void
table(array $headers, array|Arrayable $rows, string|TableStyle $tableStyle = 'default', array $columnStyles = [])
Format input to textual table.
in
InteractsWithIO at line 201
mixed
withProgressBar(iterable|int $totalSteps, Closure $callback)
Execute a given callback while advancing a progress bar.
in
InteractsWithIO at line 231
void
info(string $string, int|string|null $verbosity = null)
Write a string as information output.
in
InteractsWithIO at line 239
void
line(string $string, string|null $style = null, int|string|null $verbosity = null)
Write a string as standard output.
in
InteractsWithIO at line 249
void
comment(string $string, int|string|null $verbosity = null)
Write a string as comment output.
in
InteractsWithIO at line 257
void
question(string $string, int|string|null $verbosity = null)
Write a string as question output.
in
InteractsWithIO at line 265
void
error(string $string, int|string|null $verbosity = null)
Write a string as error output.
in
InteractsWithIO at line 273
void
warn(string $string, int|string|null $verbosity = null)
Write a string as warning output.
in
InteractsWithIO at line 287
void
alert(string $string, int|string|null $verbosity = null)
Write a string in an alert box.
in
InteractsWithIO at line 301
InteractsWithIO
newLine(int $count = 1)
Write a blank line.
in
InteractsWithIO at line 311
void
setInput(InputInterface $input)
Set the input interface implementation.
in
InteractsWithIO at line 319
void
setOutput(OutputStyle $output)
Set the output interface implementation.
in
InteractsWithIO at line 327
OutputStyle|null
getOutput()
Get the output implementation.
in
InteractsWithIO at line 335
Factory|null
outputComponents()
Get the output component factory implementation.
in
InteractsWithIO at line 343
protected void
setVerbosity(int|string $level)
Set the verbosity level.
in
InteractsWithIO at line 351
protected int
parseVerbosity(int|string|null $level = null)
Get the verbosity level in terms of Symfony's OutputInterface level.
in
InteractsWithSignals at line 20
void
trap(array|int $signo, callable $callback)
Define a callback to be run when the given signal(s) occurs.
in
InteractsWithSignals at line 35
void
untrap(array|int|null $signo = null)
Unregister signal handlers for one, many, or all signals.
in
PromptsForMissingInput at line 22
protected void
interact(InputInterface $input, OutputInterface $output)
Interact with the user before validating the input.
in
PromptsForMissingInput at line 34
protected void
promptForMissingArguments(InputInterface $input, OutputInterface $output)
Prompt the user for any missing arguments.
in
PromptsForMissingInput at line 74
protected array
promptForMissingArgumentsUsing()
Prompt for missing input arguments using the returned questions.
in
PromptsForMissingInput at line 82
protected void
afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
Perform actions after the user was prompted for missing arguments.
in
PromptsForMissingInput at line 89
protected bool
didReceiveOptions(InputInterface $input)
Determine whether the input contains any options that differ from the default values.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
GeneratorCommand at line 132
__construct(Filesystem $files = new Filesystem())
Create a new generator command instance.
in
Command at line 164
int
run(InputInterface $input, OutputInterface $output)
Run the console command.
in
Command at line 187
protected void
configureIsolation()
Configure the console command for isolation.
in
Command at line 201
protected void
configureFromAttributes()
Configure the command from class attributes.
in
Command at line 243
protected void
configureUsageFromAttribute()
Configure usage examples for the command from class attributes.
in
Command at line 255
protected void
configureUsingFluentDefinition()
Configure the console command using a fluent definition.
in
Command at line 268
protected void
configure()
No description
in
Command at line 273
protected int
execute(InputInterface $input, OutputInterface $output)
No description
in
Command at line 366
protected CommandMutex
commandIsolationMutex()
Get a command isolation mutex instance for the command.
in
Command at line 373
protected void
replaceOutput()
No description
in
Command at line 385
void
fail(string|Throwable|null $exception = null)
Fail the command manually.
in
Command at line 427
bool
isHidden()
Determine if the command is hidden.
in
Command at line 447
Application
getHypervel()
Get the Hypervel application instance.
in
Command at line 459
void
setHypervel(Application $hypervel)
Set the Hypervel application instance.
in
Command at line 467
protected array
setUpTraits(InputInterface $input, OutputInterface $output)
Set up the traits used by the command.
in
Command at line 483
static void
flushState()
Flush all static state.
in
FindsAvailableModels at line 17
protected array
findAvailableModels()
Get a list of possible model names.
in
GeneratorCommand at line 151
protected void
addPathAndNamespaceOptions()
Add the --target-path and --target-namespace options to the command definition.
Added via getDefinition() rather than getOptions() so they are always available regardless of whether a subclass overrides getOptions().
at line 41
protected string
getStub()
Get the stub file for the generator.
in
GeneratorCommand at line 180
bool|int
handle()
Execute the console command.
in
GeneratorCommand at line 231
protected string
qualifyClass(string $name)
Parse the class name and format according to the root namespace.
in
GeneratorCommand at line 259
protected string
qualifyModel(string $model)
Qualify the given model class base name.
in
GeneratorCommand at line 281
protected array
possibleModels()
Get a list of possible model names.
in
GeneratorCommand at line 291
protected array
possibleEvents()
Get a list of possible event names.
at line 59
protected string
getDefaultNamespace(string $rootNamespace)
Get the default namespace for the class.
at line 32
protected bool
alreadyExists(string $rawName)
Determine if the class already exists.
in
GeneratorCommand at line 325
protected string
getPath(string $name)
Get the destination class path.
in
GeneratorCommand at line 345
protected string
makeDirectory(string $path)
Build the directory for the class if necessary.
in
GeneratorCommand at line 355
protected void
replaceFile(string $path, string $contents)
Replace a generated file while preserving its permissions.
in
GeneratorCommand at line 377
protected string
buildClass(string $name)
Build the class with the given name.
in
GeneratorCommand at line 387
protected GeneratorCommand
replaceNamespace(string $stub, string $name)
Replace the namespace for the given stub.
in
GeneratorCommand at line 409
protected string
getNamespace(string $name)
Get the full namespace for a given class, without the class name.
in
GeneratorCommand at line 417
protected string
replaceClass(string $stub, string $name)
Replace the class name for the given stub.
in
GeneratorCommand at line 427
protected string
sortImports(string $stub)
Alphabetically sort the imports for the given stub.
in
GeneratorCommand at line 443
protected string
getNameInput()
Get the desired class name from the input.
in
GeneratorCommand at line 457
protected string
rootNamespace()
Get the root namespace for the class.
in
GeneratorCommand at line 465
protected string|null
userProviderModel()
Get the model for the default guard's user provider.
in
GeneratorCommand at line 486
protected bool
isReservedName(string $name)
Check whether the given name is reserved.
in
GeneratorCommand at line 497
protected string
viewPath(string $path = '')
Get the first view directory path from the application configuration.
at line 49
protected string
resolveStubPath(string $stub)
Resolve the fully-qualified path to the stub.