Laravel 8.14 Released

Laravel 8.14 Released

The Laravel team released 8.14 with the ability to dispatch unique jobs, support for using sockets with schema:dump, a route shortcut for alphanumeric parameters, and the latest new features, fixes, and changes in the 8.x branch. Let’s see what’s new in this release!

Dispatch Unique Jobs

Paras Malhotra contributed the ability to dispatch unique jobs that are will not dispatch another job with the same key unless the job has completed processing. Here’s an example from the pull request showing how you can use it:

use Illuminate\Contracts\Queue\ShouldBeUnique;

class MyUniqueJob implements ShouldQueue, ShouldBeUnique
{
    /**
     * The number of seconds after which the job will no longer stay unique.
     *
     * @var int
     */
     public $uniqueFor = 3600;

    public function uniqueId()
    {
        return $this->user->id;
    }
}

Model encryptUsing Method

Illia Sakovich contributed an encryptUsing model method to define an encrypted to be used with encrypted string casts. Here’s how you might use it to determine the encrypter used:

use Illuminate\Database\Eloquent\Model;
use Illuminate\Encryption\Encrypter;

$databaseEncryptionKey = config('database.encryption_key');
$encrypter = new Encrypter($databaseEncryptionKey);

Model::encryptUsing($encrypter);

MySQL Dump and Import Using Socket

Lito contributed support for using MySQL sockets with the schema:dump command. Previously you could not dump a schema if MySQL only allows socket connections.

Route Constraints for Alphanumeric

Amit Merchant contributed the whereAlphaNumeric route expression constraint to define route constraints instead of directly using the regex conveniently. Here’s an example:

// Using `where()`
Route::get('user/{name}', function ($name) {
    //
})->where('name', '[a-zA-Z0-9]+');

// New optional syntax
Route::get('user/{name}', function ($name) {
    //
})->whereAlphaNumeric('name');

Laravel 8.13 introduced a few route parameter constraint shortcuts you might want to check out!

Release Notes

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

v8.14.0

Added

  • Added ability to dispatch unique jobs (#35042, 2123e60)
  • Added Model::encryptUsing() (#35080)
  • Added support to MySQL dump and import using socket (#35083, c43054b)
  • Allow custom broadcastWith in notification broadcast channel (#35142)
  • Added Illuminate\Routing\CreatesRegularExpressionRouteConstraints::whereAlphaNumeric() (#35154)

Fixed

  • Fixed typo in make:seeder command name inside ModelMakeCommand (#35107)
  • Fix SQL Server grammar for upsert (missing semicolon) (#35112)
  • Respect migration table name in config when dumping schema (110eb15)
  • Respect them when previewing notification (ed4411d)
  • Fix appendable attributes in Blade components (#35131)
  • Remove decrypting array cookies from cookie decrypting (#35130)
  • Turn the eloquent collection into a base collection if mapWithKeys loses models (#35129)

Changed

  • Move dispatching of DatabaseRefreshed event to fire before seeders are run (#35091)
  • Handle returning false from reportable callback (55f0b5e)
  • Update Illuminate\Database\Schema\Grammars\MySqlGrammar::typeTimestamp() (#35143)
  • Remove expectedTables after converting to expectedOutput in PendingCommand (#35163)
  • Change SQLite schema command environment variables to work on Windows (#35164)

Filed in: News / Laravel 8

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Laravel Senior Developer
Remote, Canada Only
BeMo Academic Consulting
Senior Fullstack Developer / Architect (w/m/d)
Remote / Munich - Germany
envivo.select GmbH
Medior full stack developer (Laravel)
Deventer (or remote) in the Netherlands, Dutch speaking required.
MSML B.V.
Senior Full Stack PHP Developer (Laravel)
Remote
MAPPEN
Senior Laravel Developer
Remote
ACTO