11
8

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 3 years have passed since last update.

laravel + vue.jsでSPAの開発をしていてデバッグがしたい!!!

Last updated at Posted at 2020-02-04

SPAだとlaravelのエラー内容や変数とかの中身をブラウザに返すことができないけどデバッグがしたい!人用

結論
そのためには、、、
laravel debugbarとclock workの両方をcomposerでインストールする必要あり。

#STEP1 laravel debugbarのインストール

これはいつも通りですね
こちらの↓READ MEを参考に開発環境にインストール
https://github.com/barryvdh/laravel-debugbar

$ composer require barryvdh/laravel-debugbar --dev

#STEP2 clock workのインストール

これはSPAだとHTMLに返ってこないデバッグの結果をChromeのデベロッパーツールで確認できるようにするツールです!
google chrome自体へのインストールとcomposerへの両方のインストールが必要

これも以下を参照!

  • google chromeへのインストール

  • composerへのインストール
$ composer require itsgoingd/clockwork

#用法
インストールするとclockヘルパメソッドが使えるようになります!
使い方は以下のように変数の中身を確認したり、メソッドを組み合わせて使うことができる!

image.png

これも詳しい使い方は公式ドキュメント↓参照
https://underground.works/clockwork/logging?#content

また.envに以下をの設定を追加するとlaravel dubagbarが画面に表示されなくなります!

.env
DEBUGBAR_ENABLED=false

すると、、、
image.png

めちゃエラー出てるの恥ずかしいけどこんな感じで出ます!!!!!

デバッグできずに困ってた人は参考にしてみてください~

11
8
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
11
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?