Creating and using Laravel 4 commands

前端 未结 4 882
孤独总比滥情好
孤独总比滥情好 2021-02-06 01:37

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

4条回答
  •  我在风中等你
    2021-02-06 02:08

    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.

    If "Import" has many commands:

    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.

    If not,

    and you have only a single command then give your command a single clear name. protected $name = 'import';

提交回复
热议问题