path(), $not_allow_path); if($request->isMethod('POST') || $request->isMethod('PUT')) { if($contains && !in_array($request->path(),$allow_path)){ if ($request->ajax()){ return response()->json(['type' => 'warning' , 'msg' => 'This is demonstration purpose only, you may not able to change few settings, once your purchase this script you will get access to all settings.']); } return redirect()->back()->with(['type' => 'warning' , 'msg' => 'This is demonstration purpose only, you may not able to change few settings, once your purchase this script you will get access to all settings.']); } } return $next($request); } }