예제 #1
0
파일: Handler.php 프로젝트: picolit/bbs
 /**
  * 例外をレポート、もしくはログ
  *
  * ここはSentryやBugsnagなどに例外を送るために良い場所
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (!$e instanceof NotFoundHttpException) {
         $slack = new SlackBot();
         $slack->post($e->getMessage() . PHP_EOL . print_r($e->getTrace()[0], true));
     }
     return parent::report($e);
 }
예제 #2
0
파일: BbsReports.php 프로젝트: picolit/bbs
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $text = 'report date: ';
     $analysis = $this->analysis->where('date', date('Ymd', strtotime('-1 day')))->first();
     if ($analysis) {
         $text .= date('Y/m/d', strtotime($analysis->created_at));
         $text .= PHP_EOL;
         $text .= "page_view: {$analysis->page_view}";
         $text .= PHP_EOL;
         $text .= "new_post: {$analysis->new_post}";
     } else {
         $text .= $text = date('Y/m/d', strtotime('-1 day'));
         $text .= PHP_EOL;
         $text .= "page_view: 0";
         $text .= PHP_EOL;
         $text .= "new_post: 0";
     }
     $this->slackBot->post($text);
 }
예제 #3
0
 /**
  * エラーをSlackへ送信する
  * @Post("/error", as="error.postError")
  * @param ErrorPostRequest $request
  * @return \Illuminate\Http\Response
  */
 public function postError(ErrorPostRequest $request)
 {
     $text = sprintf('msg: %s, url: %s, col: %s', $request->msg, $request->url, $request->col);
     $this->slackBot->post($text);
     return response('');
 }