Introducing Laravel Quizzes! Play now

This post is more than a year old. There is a chance the content is outdated.

What's New in Laravel: 8.58 - 8.68

What's New in Laravel: 8.58 - 8.68

Are you like me and find it impossible to find the time to keep up with the changes in Laravel on a weekly basis? In this series I'll try to roll them up periodically into one post.

I'm only going to include features and not patches or fixes, for a full list visit the Laravel release log.


updateOrFail uses saveOrFail to update or throw an exception instead of just returning a bool. - PR

$user->update(); // return bool

try {
} catch (Exception $e) {
    // Exception thrown

deleteOrFail makes it more convenient to handle delete errors in destroy actions, as it is less verbose than checking the return value of delete(). - PR

$user->delete(); // return bool

try {
} catch (Exception $e) {
    // Exception thrown

valueOrFail() method, which gets a single column's value from the first result of a query or throws an exception: - PR

// Before:
$votes = User::where('name', 'John')->firstOrFail('votes')->votes;
// Now:
$votes = User::where('name', 'John')->valueOrFail('votes');

whereMorphedTo and orWhereMorphedTo are a shortcut for adding a where condition looking for models that are morphed to a specific related model, without the overhead of a whereHas subquery.- PR

$feedback = Feedback::query()
    ->where('subject_type', $model->getMorphClass())
    ->where('subject_id', $model->getKey())

// turns into
$feedback = Feedback::whereMorphedTo('subject', $model)->get();

Added whereBelongsTo() Eloquent builder method: - PR

$query->where('author_id', $author->id)

// turns into


prohibits: Allows you to prohibit a field from being passed if another is also passed. - PR

    'email' => '[email protected]', 
    'emails' => ['[email protected]', '[email protected]']
], [
    'email' => 'prohibits:emails'

merge() method to merge items to validated inputs: - PR

$validator = Validator::make(['name' => 'Taylor'], ['name' => 'required']);

$validator->safe()->merge(['role' => 'Admin']);


Multiple Date Formats - PR

public function rules()
    return [
        'date' => 'date_format:Y-m-d,m-d',


Using the collect method, you may retrieve all of the incoming request's input data as a collection: - Docs

$input = $request->collect();


Anonymous Index Blade Component Templates - Docs

Caleb Porzio contributed the ability to use index.blade.php for the default view for an anonymous component pointing to a folder:

{{-- components/accordion/index.blade.php --}}
    {{-- components/accordion/item.blade.php --}}
        {{-- ... --}}

The @aware Blade Directive -Docs

The new @aware directive allows child components to easily access parent component data when needed:

<!-- Example usage -->
<x-menu color="purple">
@aware(['color' => 'gray'])
<li {{ $attributes->merge(['class' => 'text-'.$color.'-800']) }}>
    {{ $slot }}


Maintenance Mode Events - PR

use Illuminate\Foundation\Events\MaintenanceModeEnabled;
use Illuminate\Foundation\Events\MaintenanceModeDisabled;


assertNotSoftDeleted which asserts that a given record has not been soft deleted: - PR

$this->assertNotSoftDeleted('posts', ['id' => 1]);


  • stripTags() string method - PR
  • lang_path() helper that will look for the lang directory in both the resources path and a top-level lang folder in the root of a Laravel project - PR
  • Collections "has any" Method - PR
  • createOneQuietly and createManyQuietly methods for model factories that can create one or many models and persist them to the database without model events.
  • String headline method - PR
  • restrictOnUpdate migration method- PR
Anthony Rappa

By Anthony Rappa

Hello! I'm a full stack developer from Long Island, New York. Working mainly with Laravel, Tailwind, Livewire, and Alpine.js (TALL Stack). I share everything I know about these tools and more, as well as any useful resources I find from the community. You can find me on GitHub and LinkedIn.