EDIT: Figured out where I was going wrong and placed an answer at the end
I\'m trying to create a Laravel Command, I can see it\'s changed considerably from \"tasks\" in
In newer Laravel versions there isn't an import
command. You just have to do the following two thing:
Register your command in app/start/artisan.php
:
Artisan::add(new Import);
Run the command in Artisan:
php artisan command:name Import
try this.
protected function getArguments()
{
return [];
}
protected function getOptions()
{
return [];
}
also add this in /app/start/artisan.php
Artisan::add(new ParseCommand);
then Run Command on Root directory
./artisan command:import;
Actually figured this out. Further down the documentation it states that you must register your command in "app/start/artisan.php" using the following method:
Artisan::add(new import);
Also the name you give in your command class is significant as that's what you need to use to call it. So I should have actually been calling it like so:
php artisan command:import
One final thing. What the fire() returns is unimportant, to return strings you must echo them.
there's a mis-understanding on Artisan commands because of the used wording.
In your case you choose : 'command:import' as a name of one of your 'Import' commands.
Think about it as an object, with methods.
you can use as command name > protected $name = 'import:csv';
another command would be > protected $name = 'import:txt';
and > protected $name = 'import:contacts';
so your commands with "Import" nature are better organised.
and when you request , you see your commands organised as a single entity.
and you have only a single command then give your command a single clear name. protected $name = 'import';