public function getRoutesName($contains = null, $exact = true)
    {
        $routeCollection = \Route::getRoutes();

        $routes = collect($routeCollection)->map(function($item){
            return $item->getName();
        })->filter(function($item){
            return !is_null($item);
        })->values();

        if($contains){
            return $routes->contains(function($item, $key) use($contains,$exact) {
                return $exact ? $contains == $item : str_contains($item, $contains);
            });
        }

        return $routes;
    }
public function getRoutesName($contains = null, $exact = true)
    {
        $routeCollection = \Route::getRoutes();

        $routes = collect($routeCollection)->map(function($item){
            return $item->getName();
        })->filter(function($item){
            return !is_null($item);
        })->values();

        if($contains){
            return $routes->contains(function($item, $key) use($contains,$exact) {
                return $exact ? $contains == $item : str_contains($item, $contains);
            });
        }

        return $routes;
    }
public function getRoutesName ( $ contains = null , $ exact = true ) { $ routeCollection = \ Route :: getRoutes ( ) ; $ routes = collect ( $ routeCollection ) -> map ( function ( $ item ) { return $ item -> getName ( ) ; } ) -> filter ( function ( $ item ) { return ! is_null ( $ item ) ; } ) -> values ( ) ; if ( $ contains ) { return $ routes -> contains ( function ( $ item , $ key ) use ( $ contains , $ exact ) { return $ exact ? $ contains == $ item : str_contains ( $ item , $ contains ) ; } ) ; } return $ routes ; }
Get all routes name
@param  string  $contains Search for a specific word
@param  boolean $exact    Exact search by word or not
@return array
Get all routes name