protected function failureResponse($error = null)
    {
        if (request()->ajax()) {
            return response()->json([
                'success' => false,
                'error'   => $error,
            ]);
        }

        return redirect()->back()->withErrors([
            'general' => $error,
        ]);
    }
protected function failureResponse($error = null)
    {
        if (request()->ajax()) {
            return response()->json([
                'success' => false,
                'error'   => $error,
            ]);
        }

        return redirect()->back()->withErrors([
            'general' => $error,
        ]);
    }
protected function failureResponse ( $ error = null ) { if ( request ( ) -> ajax ( ) ) { return response ( ) -> json ( [ 'success' => false , 'error' => $ error , ] ) ; } return redirect ( ) -> back ( ) -> withErrors ( [ 'general' => $ error , ] ) ; }
Returns standard failure response.

@param string|null $error
@return mixed
Returns standard failure response .