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']);
    }
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']);
    }
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' ] ) ; }
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
This method handles how submitted quests are handle the main related methods for it are POST and .