vendredi 1 décembre 2017

Laravel 5.5 Method getPath does not exist

Installed composer and did a fresh install of a new Laravel project (laravel new test) using Laravel 5.5.22. Calling a built in method getPath(), which worked in Laravel 5.4 with PHP 5.6, no longer works. How can i fix it??

PHP Version:

7.1.11-1+ubuntu14.04.1+deb.sury.org+1

Composer Version and Packages:

kevin@kevin-lt:/usr/local/bin$ composer self-update
You are already using composer version 1.5.3 (stable channel).

kevin@kevin-lt:/var/www/test$ composer show
dnoegel/php-xdg-base-dir              0.1     implementation of xdg base   directory specification for php
doctrine/inflector                    v1.2.0  Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                 1.1.0   A small, lightweight utility to instantiate objects in PHP without invoking...
doctrine/lexer                        v1.0.1  Base library for a lexer that can be used in Top-Down, Recursive Descent Pa...
egulias/email-validator               2.1.3   A library for validating emails against several RFCs
erusev/parsedown                      1.6.4   Parser for Markdown.
fideloper/proxy                       3.3.4   Set trusted proxies for Laravel
filp/whoops                           2.1.14  php error handling for cool kids
fzaninotto/faker                      v1.7.1  Faker is a PHP library that generates fake data for you.
hamcrest/hamcrest-php                 v2.0.0  This is the PHP port of Hamcrest Matchers
jakub-onderka/php-console-color       0.1    
jakub-onderka/php-console-highlighter v0.3.2 
laravel/framework                     v5.5.22 The Laravel Framework.
laravel/tinker                        v1.0.2  Powerful REPL for the Laravel framework.
league/flysystem                      1.0.41  Filesystem abstraction: Many filesystems, one API.
mockery/mockery                       1.0     Mockery is a simple yet flexible PHP mock object framework for use in unit ...
monolog/monolog                       1.23.0  Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/cron-expression             v1.2.1  CRON for PHP: Calculate the next or previous run date and determine if a CR...
myclabs/deep-copy                     1.7.0   Create deep copies (clones) of your objects
nesbot/carbon                         1.22.1  A simple API extension for DateTime.
nikic/php-parser                      v3.1.2  A PHP parser written in PHP
paragonie/random_compat               v2.0.11 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                      1.0.1   Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                       1.0.1   Library for handling version information and constraints
phpdocumentor/reflection-common       1.0.1   Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock     4.2.0   With this component, a library can provide support for annotations via DocB...
phpdocumentor/type-resolver           0.4.0  
phpspec/prophecy                      1.7.3   Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage             5.2.4   Library that provides collection, processing, and rendering functionality f...
phpunit/php-file-iterator             1.4.5   FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template             1.2.1   Simple template engine.
phpunit/php-timer                     1.0.9   Utility class for timing
phpunit/php-token-stream              2.0.2   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                       6.5.0   The PHP Unit Testing framework.
phpunit/phpunit-mock-objects          5.0.0   Mock Object library for PHPUnit
psr/container                         1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/log                               1.0.2   Common interface for logging libraries
psr/simple-cache                      1.0.0   Common interfaces for simple caching
psy/psysh                             v0.8.15 An interactive shell for modern PHP.
ramsey/uuid                           3.7.1   Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1...
sebastian/code-unit-reverse-lookup    1.0.1   Looks up which function or method a line of code belongs to
sebastian/comparator                  2.1.0   Provides the functionality to compare PHP values for equality
sebastian/diff                        2.0.1   Diff implementation
sebastian/environment                 3.1.0   Provides functionality to handle HHVM/PHP environments
sebastian/exporter                    3.1.0   Provides the functionality to export PHP variables for visualization
sebastian/global-state                2.0.0   Snapshotting of global state
sebastian/object-enumerator           3.0.3   Traverses array structures and object graphs to enumerate all referenced ob...
sebastian/object-reflector            1.1.1   Allows reflection of object attributes, including inherited and non-public ...
sebastian/recursion-context           3.0.0   Provides functionality to recursively process PHP variables
sebastian/resource-operations         1.0.0   Provides a list of PHP built-in functions that operate on resources
sebastian/version                     2.0.1   Library that helps with managing the version number of Git-hosted PHP projects
swiftmailer/swiftmailer               v6.0.2  Swiftmailer, free feature-rich PHP mailer
symfony/console                       v3.4.0  Symfony Console Component
symfony/css-selector                  v3.4.0  Symfony CssSelector Component
symfony/debug                         v3.4.0  Symfony Debug Component
symfony/event-dispatcher              v4.0.0  Symfony EventDispatcher Component
symfony/finder                        v3.4.0  Symfony Finder Component
symfony/http-foundation               v3.4.0  Symfony HttpFoundation Component
symfony/http-kernel                   v3.4.0  Symfony HttpKernel Component
symfony/polyfill-mbstring             v1.6.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php70                v1.6.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/process                       v3.4.0  Symfony Process Component
symfony/routing                       v3.4.0  Symfony Routing Component
symfony/translation                   v3.4.0  Symfony Translation Component
symfony/var-dumper                    v3.4.0  Symfony mechanism for exploring and dumping PHP variables
theseer/tokenizer                     1.1.0   A small library for converting tokenized PHP source code into XML and poten...
tijsverkoyen/css-to-inline-styles     2.2.0   CssToInlineStyles is a class that enables you to convert HTML-pages/files i...
vlucas/phpdotenv                      v2.4.0  Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVE...
webmozart/assert                      1.2.0   Assertions to validate method input/output with nice error messages.

routes/web.php

Route::get('/', 'PagesController@home');

Controllers/PagesController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Router;

class PagesController extends Controller
{

    /**
     * 
     * @return type
     */
    public function home(Router $route){

        $this->filterRoutes($route);
    }

    public function filterRoutes($route) {
        $r = $route->getRoutes();
        foreach ($r as $value) {

            dd($value->getPath());

        }
    }
}

Stack Trace:

[2017-11-30 21:00:18] local.ERROR: Method getPath does not exist.  {"exception":"[object] (BadMethodCallException(code: 0): Method getPath does not exist. at /var/www/test/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:96)
[stacktrace]
#0 /var/www/test/app/Http/Controllers/PagesController.php(27): Illuminate\\Routing\\Route->__call('getPath', Array)
#1 /var/www/test/app/Http/Controllers/PagesController.php(17): App\\Http\\Controllers\\PagesController->filterRoutes(Object(Illuminate\\Routing\\Router))
#2 [internal function]: App\\Http\\Controllers\\PagesController->home(Object(Illuminate\\Routing\\Router))
#3 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#4 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('home', Array)
#5 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\PagesController), 'home')
#6 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#7 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Route->run()
#8 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#9 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#11 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#12 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(67): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#13 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#14 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#15 /var/www/test/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#17 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#18 /var/www/test/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#20 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#21 /var/www/test/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#23 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#24 /var/www/test/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#26 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#27 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#29 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#30 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#31 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Router.php(590): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#32 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#33 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/www/test/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#38 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#39 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#40 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#41 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#44 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#47 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /var/www/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /var/www/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#50 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#51 /var/www/test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#52 /var/www/test/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#53 {main}
"} 



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2i4ihf3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire