Laravel 8.11 Released


October 21st, 2020


The Laravel team released 8.11 this week with two new job middleware, preserving eloquent collection type when calling fresh, and the latest new features, fixes, and changes in the 8.x branch.

Job Middleware for Preventing Overlapping Jobs

Paras Malhotra contributed a new job middleware for preventing overlapping jobs. An example use-case could be stopping a double refund for an order:

use Illuminate\Queue\Middleware\WithoutOverlapping;

public function middleware()
    return [
        new WithoutOverlapping($this->order->id)

Rate Limit Jobs

Paras Malhotra also contributed a RateLimitsJobs and RateLimitsJobsWithRedis middleware to the queuing system. It uses the same rate limiter class introduced in Laravel 8:

use Illuminate\Support\Facades\RateLimiter;

RateLimiter::for('backups', function ($job) {
    return $job->user->vipCustomer()
        ? Limit::none()
        : Limit::perHour(1)->by($job->user->id);

Next, you can reference the backups rate limiter in the job middleware definition:

use Illuminate\Queue\Middleware\RateLimitsJobs;

public function middleware()
    return [new RateLimitsJobs('backups')];

The queue middleware documentation includes the middleware introduced in this release.

Preserve Eloquent Collection Type after Calling fresh()

Caleb Porzio contributed an update to preserve eloquent collection type after calling ->fresh(). The pull request has the following example to illustrate the change:

// Current behavior
$users = User::all();
$users->fresh(); // Returns instance of "Illuminate\Database\Eloquent\Collection"

$users = User::all()
$users->fresh(); // Returns instance of "Illuminate\Support\Collection"

// New behavior
$users = User::all();
$users->fresh(); // Returns instance of "Illuminate\Database\Eloquent\Collection"

$users = User::all()
$users->fresh(); //  // Returns instance of "Illuminate\Database\Eloquent\Collection" as well

Release Notes

You can see the full list of new features and updates below and the diff between 8.10.0 and 8.11.0 on GitHub. The following release notes are directly from the changelog:



  • Added job middleware to prevent overlapping jobs (#34794, eed05b4)
  • Bring Rate Limiters to Jobs (#34829, ae00294)
  • Added multiple_of custom replacer in validator (#34858)
  • Preserve eloquent collection type after calling ->fresh() (#34848)
  • Provisional support for PHP 8.0 for 6.x (Changed some code in 8.x) (#34884, 28bb76e)


  • Fixed fresh() and refresh() on pivots and morph pivots (#34836)
  • Fixed config batching typo (#34852)
  • Fixed Illuminate\Queue\Console\RetryBatchCommand for un-found batch id (#34878)


  • Change loadRoutesFrom() to accept group $attributes (#34866)



Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.