LoginSignup
2
5

More than 5 years have passed since last update.

Laravelでコマンドをつくる

Last updated at Posted at 2018-03-07

app/Console ディレクトリ内でつくることができる。

コマンドの処理を書くクラスを作成

php artisan make:command test

protected $signature

コマンド名。実行するときは php artisan をつけて以下のように実行。

php artisan command:name

handle()

ここに処理を書く。

スクリーンショット 2017-04-26 15.18.44.png

コマンドを使えるように登録

Kernel.php

    protected $commands = [
        test::class,
    ];

としてコマンドを登録する。

2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5