Laravel 8.61 Released


September 15th, 2021

Laravel 8.61 Released

The Laravel team released 8.61 with a delete or fail() model method, a value or fail model method, assert if a model exists in a test and the latest changes in the v8.x branch.

Delete or Fail Model Method

Claas Augner contributed a deleteOrFail() method that makes it more convenient to handle model delete errors and less verbose than checking the return value of delete():

try {
} catch (\Throwable $e) {
// ...

Assert If a Model Exists Test Method

@RVxLab contributed a assertModelExists() testing method to test whether a model exists in the database. Taylor Otwell also added a assertModelMissing method:

$product = Product::find(1);
// ...
$this->assertDatabaseHas('products', [
'id' => $product->getKey(),

Value or Fail Model Method

In the only new feature of Laravel 8.60, @Italo contributed a valueOrFail() method, which gets a single column's value from the first result of a query or throws an exception:

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

Allows Tests to Utilize the Null Logger

Tim MacDonald contributed a new update where tests can utilize the null logger. Check out Pull Request #38785 for more details on the situation and updates made.

Create a Policy While Creating a Model

Tim Fevens contributed a --policy flag, which is also included with the --all flag as well:

php artisan make:model --policy Post

Release Notes

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



  • Added possibility compare custom date/immutable_date using date comparison (#38720)
  • Added policy option to make:model (#38725
  • Allow tests to utilise the null logger (#38785)
  • Added deleteOrFail to Model (#38784)
  • Added assertExists testing method (#38766)
  • Added forwardDecoratedCallTo to Illuminate/Database/Eloquent/Relations/Relation (#38800)
  • Adding support for using a different Redis DB in a Sentinel setup (#38764)


  • Return on null in Illuminate/Queue/Queue::getJobBackoff() (27bcf13)
  • Provide psr/simple-cache-implementation (#38767)
  • Use lowercase for hmac hash algorithm (#38787)



  • Added the valueOfFail() Eloquent builder method (#38707)


Filed in:

Paul Redmond

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