Blog Detail

30

Sep
Laravel 8.62 Released - Analysis of Features And Updates cover image

arrow_back Laravel 8.62 Released - Analysis of Features And Updates

Laravel is a powerful MVC PHP framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel was created by Taylor Otwell. Laravel provides an out-of-the-box configuration for the Authentication and Authorization system. Laravel has released its new version V8.62, Which accompanies many new features and updates in the 8.x branch. Today, in this article, I will share some exciting features and updates of Laravel 8.62 with you.

Add singular syntactic sugar to the wormhole

Dwight Watson contributed in singular_wormhole, which appends syntactic sugar to the Wormhole for when utilizing singular values.

// Before
$this->travel(1)->weeks();
$this->travel(-1)->weeks();

// After
$this->travel(1)->week();
$this->travel(-1)->week();

Each existing unit gets a singular alias that defers back to the original.

Dispatch events when maintenance mode is enabled and disabled

Andréas Lundgren introduces a feature of maintenance mode events. This feature makes it easy to trigger actions when the application is put into, or taken out of, maintenance mode.

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

Event::dispatch(MaintenanceModeEnabled::class);
Event::dispatch(MaintenanceModeDisabled::class);

If you want to tap into external services, these events are significant to tell them to ignore any uptime or monitoring alerts.

Add assertNotSoftDeleted Method

Francisco Madeira added an assertNotSoftDeleted feature, which adds the capability to test if a model was not marked as soft deleted.

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

Add --pretend option for model:prune command

Shalvah comes with a peculiarity that adds a –pretend option to model:prune, similar to the one for migration. As prune is a potentially destructive command (a typo in a query could wipe out the wrong half of your database!), it’s helpful to have an extra way to “sanity check” before committing.

php artisan model:prune --pretend

The pretend option will print the number of records matching the prunable() query.

Make PendingMail Conditionable

Ryan Chandler added a feature that adds the Conditionable trait to the PendingMail object. Which will let you use when() and unless() methods while configuring an email before calling send(), queue(), etc.

Adds --pest option when using the make:test artisan command

Luke Downing introduces a feature that adds support for Pest PHP when generating tests by adding a --pest option to the php artisan make:test command. The make:test command, sponsors two new stubs, one for Pest feature tests and the other for Pest unit tests. These match the functionality of the existing PhpUnit tests but are written in Pest.

Feature test stub:

<?php
test('foobar', function () {
    $response = $this->get('/');
    $response->assertStatus(200); 
});

Unit test stub:

<?php
test('foobar', function () {
    expect(true)->toBeTrue();
});

v8.62.0

  • Added singular syntactic sugar to wormhole (#38815)
  • Added a few PHP 8.1 related changes (#38404, #38961)
  • Dispatch events when maintenance mode is enabled and disabled (#38826)
  • Added assertNotSoftDeleted Method (#38886)
  • Adds new RefreshDatabaseLazily testing trait (#38861)
  • Added --pretend option for model:prune command (#38945)
  • Make PendingMail Conditionable (#38942)
  • Adds --pest option when using the make:test artisan command (#38966)

Reverted

Changed

  • Make mailable assertions fluent (#38850)
  • Allow request input to be retrieved as a collection (#38832)
  • Allow index.blade.php views for anonymous components (#38847)
  • Changed *ofMany to decide relationship name when it is null (#38889)
  • Ignore trailing delimiter in cache.headers options string (#38910)
  • Only look for files ending with .php in model:prune (#38975)
  • Notification assertions respect shouldSend method on notification (#38979)
  • Convert middleware to the array when outputting as JSON in /RouteListCommand (#38953)

Closing Notes

You can view the whole list of new features and updates here.

Published at : 30-09-2021

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project