Creating and using Laravel 4 commands

前端 未结 4 888
孤独总比滥情好
孤独总比滥情好 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:05

    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.

提交回复
热议问题