public function checkNamespace(Request $request)
    {
        if (isset($request->path)) {
            $path = $this->parseModel($request->path);
            $path = base_path(trim(str_replace('\\', '/', $request->path)), '\\');
            $path = str_replace('App', 'app', $path);
            if (file_exists($path.'.php')) {
                return response()->json((object) [
                    'type'    => 'error',
                    'message' => 'File exists Already',
                ]);
            } else {
                return response()->json((object) [
                    'type'    => 'success',
                    'message' => 'File can be generated at this location',
                ]);
            }
        } else {
            return response()->json((object) [
                'type'    => 'error',
                'message' => 'Please provide some value',
            ]);
        }
    }
public function checkNamespace(Request $request)
    {
        if (isset($request->path)) {
            $path = $this->parseModel($request->path);
            $path = base_path(trim(str_replace('\\', '/', $request->path)), '\\');
            $path = str_replace('App', 'app', $path);
            if (file_exists($path.'.php')) {
                return response()->json((object) [
                    'type'    => 'error',
                    'message' => 'File exists Already',
                ]);
            } else {
                return response()->json((object) [
                    'type'    => 'success',
                    'message' => 'File can be generated at this location',
                ]);
            }
        } else {
            return response()->json((object) [
                'type'    => 'error',
                'message' => 'Please provide some value',
            ]);
        }
    }
public function checkNamespace ( Request $ request ) { if ( isset ( $ request -> path ) ) { $ path = $ this -> parseModel ( $ request -> path ) ; $ path = base_path ( trim ( str_replace ( '\\' , '/' , $ request -> path ) ) , '\\' ) ; $ path = str_replace ( 'App' , 'app' , $ path ) ; if ( file_exists ( $ path . '.php' ) ) { return response ( ) -> json ( ( object ) [ 'type' => 'error' , 'message' => 'File exists Already' , ] ) ; } else { return response ( ) -> json ( ( object ) [ 'type' => 'success' , 'message' => 'File can be generated at this location' , ] ) ; } } else { return response ( ) -> json ( ( object ) [ 'type' => 'error' , 'message' => 'Please provide some value' , ] ) ; } }
Checking the path for a file if exists.

@param Request $request
Checking the path for a file if exists .