status = $status; } /** * Create an HTTP response that represents the object. * * @param \Illuminate\Http\Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function toResponse($request) { return $request->wantsJson() ? new JsonResponse(['message' => trans($this->status)], 200) : back()->with('status', trans($this->status)); } }