Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Laravel 5.8.12 Released

Published on by

Laravel 5.8.12 Released image

Never Miss a Laravel Release 🚀

Sign up and get an email with each new Laravel release

The Laravel team released the 400th release of Laravel (v5.8.12) yesterday with a new duplicates() collection method and other new features, fixes, and changes to the framework.

First, a new duplicates() method was added to the Illuminate\Support\Collection class:

collect([1,2,1,1,1])->duplicates();
=> Illuminate\Support\Collection {#2938
all: [
2 => 1,
3 => 1,
4 => 1,
],
}

It works by returning the indexes of the duplicate values from the original collection object:

$item[0] = 1 is not a duplicate
$item[1] = 2 is not a duplicate
$item[2] = 1 is a duplicate
$item[3] = 1 is a duplicate
$item[4] = 1 is a duplicate

Similarly, a new duplicates() method was added to the Eloquent collection class, using the $model->is($another) to check for duplicates. Here’s an example from PR #28194:

use App\User;
 
$one = User::find(1);
$two = User::find(1);
$three = User::find(1);
 
$users = (new User)->newCollection([$one, $two, $three]);
 
=> Illuminate\Database\Eloquent\Collection {#2936
all: [
1 => App\User {#2929
id: "1",
name: "Admin",
email: "admin@example.com",
email_verified_at: null,
created_at: "2019-04-16 23:33:30",
updated_at: "2019-04-16 23:33:30",
},
2 => App\User {#2927
id: "1",
name: "Admin",
email: "admin@example.com",
email_verified_at: null,
created_at: "2019-04-16 23:33:30",
updated_at: "2019-04-16 23:33:30",
},
],
}

Next, a new getViews() method was added to the FileViewFinder class, which allows you to retrieve all the view information from currently loaded views. Nothing is new here except the ability to access the $views property via the getViews() method.

As of Laravel 5.8.11 the exit code is captured in scheduled command events, which lead to a new PR providing some helpers available to the scheduler:

$schedule->command('my:command')
->onSuccess(function () {
// do something when scheduled command ran successfully
})
->onFailure(function () {
// do something when scheduled command failed
})
->pingOnSuccess('https://example.com')
->pingOnFailure('https://example.com')
->emailOnFailure('johndoe@example.com')
;

The emailOnFailure() method is useful when you only want to receive an email for failed scheduled commands as opposed to the emailOutputTo method which is sent no matter what the outcome of the scheduled task. The new scheduler methods have already been added to the scheduling documentation.

Next, the SET datatype was added to the MySQL grammar (learn more about The SET Type):

Schema::create('table_name', function (Blueprint $table) {
$table->bigIncrements('id');
$table->set("field_name", [ "Possible", "Values" ]);
$table->timestamps();
});

The last new feature in this release is the addition of the in and not in operators, which can be passed as strings to the query builder:

// these two calls produce the same query
$query->where('foo', 'in', [1, 2]);
$query->whereIn('foo', [1, 2]);
 
// these two calls produce the same query
$query->where('foo', 'not in', [1, 2]);
$query->whereNotIn('foo', [1, 2]);

You can see the full list of fixes below, and the whole diff between 5.8.11 and 5.8.12 on GitHub. The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:

v5.8.12

Added

  • Added Illuminate\Support\Collection::duplicates() (#28181)
  • Added Illuminate\Database\Eloquent\Collection::duplicates() (#28194)
  • Added Illuminate\View\FileViewFinder::getViews() (#28198)
  • Added helper methods onSuccess() \ onFailure() \ pingOnSuccess() \ pingOnFailure() \ emailOnFailure() to Illuminate\Console\Scheduling\Event (#28167)
  • Added SET datatype on MySQL Grammar (#28171)
  • Added possibility for use in / not in operators in the query builder (#28192)

Fixed

  • Fixed memory leak in JOIN queries (#28220)
  • Fixed circular dependency in Support\Testing\Fakes\QueueFake for undefined methods (#28164)
  • Fixed exception in lt \ lte \ gt \ gte validations with different types (#28174)
  • Fixed string quoting for SQL Server (#28176)
  • Fixed whereDay and whereMonth when passing int values (#28185)

Changed

  • Added autocomplete attributes to the html stubs (#28226)
  • Improved event:list command (#28177, cde1c5d)
  • Updated Illuminate\Database\Console\Factories\FactoryMakeCommand to generate more IDE friendly code (#28188)
  • Added missing LockProvider interface on DynamoDbStore (#28203)
  • Change session’s user_id to unsigned big integer in the stub (#28206)
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

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

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

Bacancy
Tinkerwell logo

Tinkerwell

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

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
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
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

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
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant 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

The latest

View all →
A new beta of Laravel Wayfinder just dropped image

A new beta of Laravel Wayfinder just dropped

Read article
Ben Bjurstrom: Laravel is the best Vibecoding stack for 2026 image

Ben Bjurstrom: Laravel is the best Vibecoding stack for 2026

Read article
Laravel Altitude - Opinionated Claude Code agents and commands for TALL stack development image

Laravel Altitude - Opinionated Claude Code agents and commands for TALL stack development

Read article
JSON:API Resource in Laravel 12.45 image

JSON:API Resource in Laravel 12.45

Read article
Caching With MongoDB for Faster Laravel Apps image

Caching With MongoDB for Faster Laravel Apps

Read article
Laravel 12.44 Adds HTTP Client afterResponse() Callbacks image

Laravel 12.44 Adds HTTP Client afterResponse() Callbacks

Read article