Reputation: 6581
wills, I am in the app (aka project) directory. The artisan file is in the directory that I am in.
Next...if I run the following command I get output (a list of the available commands):
php artisan list
But if I run this command (purposefully leaving out a required argument), i don't get any error though i expect one:
php artisan make:command
artisan
seems to be unhappy in its configuration given that this purposefully incomplete command results in: no output.
things i've tried
find -L ./ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | grep "Errors parsing"
uncovers no files that have syntax errorscomposer update
composer install
php artisan optimize
Please offer solutions that will cause php artisan bad:command
to complain as it should.
Upvotes: 2
Views: 13211
Reputation: 81
The solution is:
use
php artisan migrate
instead of
php artinsa make:migration
When the above error happens, it is because the migrate has already been created.
EDIT: Removed portuguese translation of the answer.
Upvotes: 8
Reputation: 11340
First. php artisan make:command Mycommand
Second. nano app/Console/Commands/Mycommand.php
and set protected $signature = 'mycommand';
Third. Code your logic in the file:
public function handle()
{
$this->info('place your logic here');
}
Fourth. Add command to app/Console/Kernel.php
protected $commands = [
Commands\Mycommand::class
];
Check: $ php artisan mycommand
outputs place your logic here
.
Schedule: Edit the same Kernel.php
file
protected function schedule(Schedule $schedule)
{
$schedule->command('mycommand')
->dailyAt('02:00')
->appendOutputTo('./mycommand.log')
->withoutOverlapping();;
}
It works as expected.
$ php artisan make:command
[Symfony\Component\Console\Exception\RuntimeException]
Not enough arguments (missing: "name").
$ php artisan --version
Laravel Framework version 5.3.30
Upvotes: 0