Call laravel controller via command line

后端 未结 5 2096
礼貌的吻别
礼貌的吻别 2020-11-29 03:17

In kohana framework I can call controller via command line using

php5 index.php --uri=controller/method/var1/var2

Is it possible to call co

5条回答
  •  情歌与酒
    2020-11-29 03:49

    I am using Laravel 5.0 and I am triggering controllers using this code:

    $ php artisan tinker
    $ $controller = app()->make('App\Http\Controllers\MyController');
    $ app()->call([$controller, 'myMethodName'], []);
    

    the last [] in the app()->call() can hold arguments such as [user_id] => 10 etc'

提交回复
热议问题