Ad

Laravel 5's Route Helper Doesn't Work On Fresh Install

- 1 answer

I am following a tutorial sayings that Laravel has a helper that permits to write the routes like that :

<?php 
get('/', function () {
return view('welcome');
});

Instead of :

<?php
Route::get('/', function () {
    return view('welcome');
});

(The "Route::" prefix is missing in the first one).

Since what i've looked the documentation (where I've found nothing really related but the providers involved), I correctly have in my providers :

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        (...)
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        (...)
        /*
         * Application Service Providers...
         */
        (...)
        App\Providers\RouteServiceProvider::class,
        (...)

    ],

And the tutorial says that it has to work in a fresh install.

Ad

Answer

The router helper functions were removed in December. You can see the changes here:

https://github.com/laravel/framework/commit/62cbae78ba2d40944892c5a16f2d2463087bce23

In the upgrade guide, you can see what is deprecated and removed.

The get, post, and other route helper functions have been removed. You may use the Route facade instead.

Source: https://laravel.com/docs/5.2/upgrade

Ad
source: stackoverflow.com
Ad