Laravel 8.14 Released

Published on by

Laravel 8.14 Released image

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)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Tinkerwell

Version 4 of Tinkerwell is available now. Get the most popular PHP scratchpad with all its new features and simplify your development workflow today.

Visit Tinkerwell
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with Vue and Livewire stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
SQLite Studio is a SQLite Database Explorer image

SQLite Studio is a SQLite Database Explorer

Read article
Running a Single Test, Skipping Tests, and Other Tips and Tricks image

Running a Single Test, Skipping Tests, and Other Tips and Tricks

Read article
View Third-party Relations in model:show - Now Available in Laravel 11.11 image

View Third-party Relations in model:show - Now Available in Laravel 11.11

Read article
Asserting a JSON Response Structure in Laravel image

Asserting a JSON Response Structure in Laravel

Read article
Backpack turns 8 years old, celebrates with 40% discount image

Backpack turns 8 years old, celebrates with 40% discount

Read article
Create a DateTime from a Timestamp With this New Method Coming to PHP 8.4 image

Create a DateTime from a Timestamp With this New Method Coming to PHP 8.4

Read article