Ejemplo n.º 1
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof QueryException) {
         Log::emergency($e->getMessage());
         return response()->json(["Houve um erro interno no servidor."], 500);
     }
     return parent::render($request, $e);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $task = Task::findOrFail($id);
         $task->delete();
         return response()->json(['destroy' => true]);
     } catch (Exception $e) {
         Log::emergency('TaskAPIController::destroy can not destroy task', ['task_id' => $id]);
         return response()->json(['destroy' => true], 500);
     }
 }
Ejemplo n.º 3
0
 /**
  * System is unusable.
  *
  * @param string $message
  * @param array $context
  *
  * @return bool
  */
 public function emergency($message, array $context = [])
 {
     return Log::emergency($message, $context);
 }
Ejemplo n.º 4
0
 /**
  * @param        $data
  * @param array  $contextualData
  * @param array  $location
  */
 public static function emergency($data, array $location = [], array $contextualData = [])
 {
     $msg = self::renderMessage($data, $location);
     /** @noinspection PhpUndefinedMethodInspection */
     BaseLog::emergency($msg, $contextualData);
 }