0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OctoberCMSプラグイン作成:対話式インタプリタ(tinker)で実行結果を確認する

Last updated at Posted at 2018-11-30

ちょっとメソッドの挙動を確認したい、けどテスト用のクラスを作成するのも面倒、という時に気軽にコードを実行できるのがtinkerだ。tinkerはLaravelのartisanコマンドなので、正直OctoberCMS独自の機能ではない。

起動

artisanがあるディレクトリ(Octoberプロジェクトのルート)で下記を実行すると、シェルが起動する。

$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.0.30-0ubuntu0.16.04.1 — cli) by Justin Hileman
>>> 

モデルクラスを試してみる

>>> use Cocci\Ec\Models\Product;
>>> MobileSuite::find(2);
=> Pikanji\Gundam\Models\MobileSuite {#3511
     id: 2,
     name: "ギャン",
     code: "YMS-15",
     pilot: "マ・クベ"
   }

便利。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?