original_string: protected function modelHasBeenSaved($saved, $type, $request)
      {
          if (!$saved) {
              return response()->json(['message' => 'Failed to '.$type.' resource', 'code' => 422], 422);
          }
          $status = $request->ajax() ? 202 : 200;
          if ($request->ajax()) {
              return response()->json(['message' => 'Successfully '.$type.' resource', 'code' => $status], $status);
          }
          if ($request->has('_redirect')) {
              // Remove the base part of the url, and just grab the tail end of the desired redirect, that way the
              // User can't be redirected away from your website.
              return $this->returnRedirect('Successfully '.$type.' resource', $request);
          }
  
          return redirect()->back()->with(['message' => 'Successfully '.$type.' resource']);
      }
code: protected function modelHasBeenSaved($saved, $type, $request)
      {
          if (!$saved) {
              return response()->json(['message' => 'Failed to '.$type.' resource', 'code' => 422], 422);
          }
          $status = $request->ajax() ? 202 : 200;
          if ($request->ajax()) {
              return response()->json(['message' => 'Successfully '.$type.' resource', 'code' => $status], $status);
          }
          if ($request->has('_redirect')) {
              // Remove the base part of the url, and just grab the tail end of the desired redirect, that way the
              // User can't be redirected away from your website.
              return $this->returnRedirect('Successfully '.$type.' resource', $request);
          }
  
          return redirect()->back()->with(['message' => 'Successfully '.$type.' resource']);
      }
code_tokens: protected function modelHasBeenSaved ( $ saved , $ type , $ request ) { if ( ! $ saved ) { return response ( ) -> json ( [ 'message' => 'Failed to ' . $ type . ' resource' , 'code' => 422 ] , 422 ) ; } $ status = $ request -> ajax ( ) ? 202 : 200 ; if ( $ request -> ajax ( ) ) { return response ( ) -> json ( [ 'message' => 'Successfully ' . $ type . ' resource' , 'code' => $ status ] , $ status ) ; } if ( $ request -> has ( '_redirect' ) ) { // Remove the base part of the url, and just grab the tail end of the desired redirect, that way the // User can't be redirected away from your website. return $ this -> returnRedirect ( 'Successfully ' . $ type . ' resource' , $ request ) ; } return redirect ( ) -> back ( ) -> with ( [ 'message' => 'Successfully ' . $ type . ' resource' ] ) ; }
docstring: This method handles how submitted quests are handle, the main related methods for it are
  POST and.
  
  @param $saved
  @param $request
  
  @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
docstring_tokens: This method handles how submitted quests are handle the main related methods for it are POST and .