3

I have an old version of Spark running so decided to upgrade my license and start testing a new installation. First, I installed a vanilla Laravel, that worked.

Next, I followed the documentation from https://spark.laravel.com/docs/11.0/installation and I am on Ubuntu 18.04. There were some issues with an older version of node and npm but I finally have them figured out. All commands are successfully, so after doing PHP artisan migrate I checked the website but I am seeing:

Target class [App\Http\Middleware\PreventRequestsDuringMaintenance] does not exist.

Illuminate\Container\Container::build
vendor/laravel/framework/src/Illuminate/Container/Container.php

And indeed, when I checked the folder:

root@spark10:/var/www/html/spark/app/Http/Middleware# ls -al
total 44
drwxr-xr-x 2 www-data www-data 4096 Oct 31 20:46 .
drwxr-xr-x 4 www-data www-data 4096 Oct 31 09:17 ..
-rw-r--r-- 1 www-data www-data  469 Oct 31 09:17 Authenticate.php
-rw-r--r-- 1 www-data www-data  335 Oct 31 09:17 CheckForMaintenanceMode.php
-rw-r--r-- 1 www-data www-data  294 Oct 31 09:17 EncryptCookies.php
-rw-r--r-- 1 www-data www-data  568 Oct 31 18:34 RedirectIfAuthenticated.php
-rw-r--r-- 1 www-data www-data  340 Oct 31 09:17 TrimStrings.php
-rw-r--r-- 1 www-data www-data  354 Oct 31 09:17 TrustHosts.php
-rw-r--r-- 1 www-data www-data  441 Oct 31 09:17 TrustProxies.php
-rw-r--r-- 1 www-data www-data  307 Oct 31 09:17 VerifyCsrfToken.php

Interestingly, when I examine the PreventRequestsDuringMaintenance.php online, I see: https://github.com/laravel/laravel/commit/e471dd1cf09907b2d325f5ef4a9aefc4b1f2e5c5#diff-f98b07c0f713c816a5c288db58fcd03aab070df160a3bf47b6feb035d3f8ca2c that it is renamed from CheckForMaintenanceMode to PreventRequestsDuringMaintenance

I created a new file PreventRequestsDuringMaintenance.php


namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;

class PreventRequestsDuringMaintenance extends Middleware
{
    /**
     * The URIs that should be reachable while maintenance mode is enabled.
     *
     * @var array
     */
    protected $except = [
        //
    ];
}

And while I am writing this question, I see I messed up some names and after fixing that I see the Spark login. So I fixed it already, still posting this question because it might help some other poor chap.

helloworld
  • 223
  • 1
  • 7
  • 24

0 Answers0