0
1

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.

LaraDockのLaravelでTelescopeを使う

Posted at

LaraDockのlaravelでTelescopeを使うまでの手順。公式サイトの手順そのままです。

インストール

docker-compose exec workspace bash

composer require laravel/telescope --dev

開発環境でのみ使用するので --dev をつけておく。インストールが終了したら

php artisan telescope:install

php artisan migrate

どうやらデータベースを使うようだ。アップデートには下記のコマンドを使用するらしい。

php artisan telescope:publish

開発環境のみで使用するので、app.phpのサービスプロバイダの登録から TelescopeServiceProvider を削除しておきます。

// App\Providers\TelescopeServiceProvider::class,

AppServiceProvider に以下を追加する。公式に書いてあるそのまま。

use Laravel\Telescope\TelescopeServiceProvider;

/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    if ($this->app->isLocal()) {
        $this->app->register(TelescopeServiceProvider::class);
    }
}

開発環境なのでデータが増えていっても特に必要ないけど、telescope:prune をスケジューリングしておくこともできる。

$schedule->command('telescope:prune')->daily();

デフォルトだと24時間で、時間指定もできるようだ。

$schedule->command('telescope:prune --hours=48')->daily();

設定

config/telescope.php に追加される。

.env
TELESCOPE_DRIVER=database
TELESCOPE_ENABLED=true
TELESCOPE_CACHE_WATCHER=true
TELESCOPE_COMMAND_WATCHER=true
TELESCOPE_DUMP_WATCHER=true
TELESCOPE_EVENT_WATCHER=true
TELESCOPE_EXCEPTION_WATCHER=true
TELESCOPE_JOB_WATCHER=true
TELESCOPE_LOG_WATCHER=true
TELESCOPE_MAIL_WATCHER=true
TELESCOPE_MODEL_WATCHER=true
TELESCOPE_NOTIFICATION_WATCHER=true
TELESCOPE_QUERY_WATCHER=true
TELESCOPE_REDIS_WATCHER=true
TELESCOPE_REQUEST_WATCHER=true
TELESCOPE_RESPONSE_SIZE_LIMIT=64
TELESCOPE_GATE_WATCHER=true
TELESCOPE_SCHEDULE_WATCHER=true

必要ないものはfalseにしておけばいいと思う、設定の内容については公式に書いてるので省略。デフォルトでは全部true

ダッシュボード

あとは上記にアクセスするだけ。ローカル以外でダッシュボードにアクセスさせるときには設定が必要なので、そのあたりは公式サイトを確認してください。

スクリーンショット 2018-12-16 16.54.10.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?