Support the ongoing development of Laravel.io →
Configuration Requests Installation
Last updated 1 year ago.
0

Assigning the web middleware group shouldn't be necessary as it is applied automatically by laravel.

Try changing your server config so that it points towards the public folder as the site root.

0

Thanks for chipping in.

Ok, in routes.php I commented out the Route::group(['middleware' => ['web']], function () { , in app.php I set the app root to /public and in Kernel.php I moved all of this \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, out of the web middleware group to the global middleware. I still get a not found when I try to submit the form. If I put a breakpoint in index.php it only gets hit for the root url. /task doesn't even hit index.php.

Last updated 7 years ago.
0

I just added a dummy route to routes.php

Route::get("/fish", function () { return 'this is a get'; });

And if I try to go straight to it, (http get) I still see a 404.

Last updated 7 years ago.
0

This is what should be set by default in your Kernel.php

    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
        ],

        'api' => [
            'throttle:60,1',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    ];

which is the default. Don't remove the web middleware group.

Make sure that in your .env file, APP_DEBUG is set to true. Will give you more feedback if something goes wrong.

0

With that Kernel.php I get

Undefined variable: errors (View: /var/www/html/quickstart/resources/views/common/errors.blade.php) (View: /var/www/html/quickstart/resources/views/common/errors.blade.php), and the solution I got from SO was to put the ShareErrorsFromSession class in the $middleware array.

What's curious is that index.php is never hit except for app root ('/')'.

Mark

0

FIXED!!!! Prob was htaccess file. Need to set AllowOverride for web root to All in apache2.conf. Explanation here http://www.epigroove.com/blog/laravel-routes-not-working-make-... ... Phew... thanks for the suggestions anyway :)

Be a good idea to update the QuickStart notes to avoid people losing a day of their lives.

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sparkietm sparkietm Joined 10 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.