Laravel 8.10 Released


October 14th, 2020

Laravel 8.10 Released

The Laravel team released 8.10 this week with job chains within batches, database upserts, and the latest new features, fixes, and changes in the 8.x branch.

Job Chains in Batches

Kevin Ullyott contributed job chaining within batches. You can add chaining by passing a sub-array of job classes like so:

1$batch = Bus::batch([
2 new Test1Job(),
3 [
4 new Test2Job(),
5 new Test3Job(),
6 new Test4Job(),
7 ]
8])->then(function (Batch $batch) {
9 Log::info('Test Complete!');

Add is() Method to Model Relations

Sébastien Nikolaou contributed the is() and isNot() methods to Eloquent relations without an extra query:

1// Before: performs extra query to fetch the user model from the author relation
5// After

Add Upsert to Eloquent and Query Builder

Paras Malhotra contributed upserting records, which will bulk insert records and update those with duplicate keys. The first argument is the data to be inserted/updated, and the second argument is the column(s) that uniquely identify a given record:

2 ['id' => 1, 'email' => ''],
3 ['id' => 2, 'email' => ''],
4], 'email');
6// Or with models
8 ['id' => 1, 'email' => ''],
9 ['id' => 2, 'email' => ''],
10], 'email');

A newline method for console IO

Scott Carpenter contributed a newLine() method you can use to output a blank line in Artisan console output:

1// What you might do now...
3$this->info('Parsing CSV file');
6// You could already do the following
9// This feature adds a shortcut
12// You can specify the number of blank lines

A canAny() Method for Authorizable Models

Denis Duliçi contributed a canAny method to the Authorizable trait that the User model supports. This allows the following (similar to the blade feature with the same name):

1$user->canAny(['permission-one', 'permission-two'])

MailMessage when() and unless() Methods

Kuba Szymanowski contributed new convenience methods to the MailMessage class for when you want to change the mail message conditionally:

1public function toMail(User $user)
3 return (new MailMessage)
4 ->when(
5 $this->offer->acceptation_comment,
6 function(MailMessage $message, $comment) {
7 $message->line('Your offer has been rejected with a comment:')
8 ->line($comment);
9 },
10 function(MailMessage $message) {
11 $message->line('Your offer has been rejected.');
12 }
13 );

Release Notes

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



  • Allow for chains to be added to batches (#34612, 7b4a9ec)
  • Added is() method to 1-1 relations for model comparison (#34693, 7ba2577)
  • Added upsert to Eloquent and Base Query Builders (#34698, #34712, 58a0e1b)
  • Support psql and pg_restore commands in schema load (#34711)
  • Added Illuminate\Database\Schema\Builder::dropColumns() method on the schema class (#34720)
  • Added yearlyOn() method to scheduler (#34728)
  • Added restrictOnDelete method to ForeignKeyDefinition class (#34752)
  • Added newLine() method to InteractsWithIO trait (#34754)
  • Added isNotEmpty method to HtmlString (#34774)
  • Added delay() to PendingChain (#34789)
  • Added ‘multiple_of’ validation rule (#34788)
  • Added custom methods proxy support for jobs ::dispatch() (#34781)
  • Added QueryBuilder::clone() (#34780)
  • Support bus chain on fake (a952ac24)
  • Added missing force flag to queue:clear command (#34809)
  • Added dropConstrainedForeignId to `Blueprint (#34806)
  • Implement supportsTags() on the Cache Repository (#34820)
  • Added canAny to user model (#34815)
  • Added when() and unless() methods to MailMessage (#34814)


  • Fixed collection wrapping in BelongsToManyRelationship (9245807)
  • Fixed LengthAwarePaginator translations issue (#34714)


  • Improve schedule:work command (#34736, bbddba2)
  • Guard against invalid guard in make:policy (#34792)
  • Fixed router inconsistency for namespaced route groups (#34793)

Filed in:

Paul Redmond

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