Laravel 7.4.0 Out

Proxy for Collections

Loris Leiva, Collection::when()the method contributed to the ability to use a higher proxy:

// With this PR, this:
$collection->when($condition, function ($collection) use ($item) {
$collection->push($item);
});
// ... can be refactored as this:
$collection->when($condition)->push($item);

This PR allows you to chain other high-level proxy methods:

// This:
$collection->when($condition, function ($collection) {
$collection->map->parseIntoSomething();
});
// ... can be refactored as this:
$collection->when($condition)->map->parseIntoSomething();

Artisan expectsChoice() Assertion

Adrian Nuremberger contributed a command-testing method to question the elections.

Given the following example:

$name = $this->choice ('What is your name?', ['Taylor', 'Dayle'], $defaultIndex);

You can only get the answer to this query; you cannot test the options provided.

$this->artisan('question')
->expectsQuestion('What is your name?', 'Taylor')
->assertExitCode(0);

With Laravel 7.4, you can:

$this->artisan('question')
->expectsChoice('What is your name?', 'Taylor', ['Taylor', 'Dayle'])
->assertExitCode(0);

You can also change the order of options by querying a fourth boolean argument:

$this->artisan('question')
->expectsChoice('What is your name?', 'Taylor', ['Taylor', 'Dayle'], true)
->assertExitCode(0);

Default Values for @Props Blade Tag

@nihilsen contributed to the ability to define default supports in the following ways @props:


@props(['type', 'message'])
@php
$type = $type ?? 'info'
@endphp

@props(['type' => 'info', 'message'])

Remove An Order from a Query Builder

Jonathan Reinink reorder()orderBy()added a method to the query builder to reset calls:

$query = DB::table('users')->orderBy('name'); $unorderedUsers = $query->reorder()->get();

Reorder allows you to define the default layout in related tables with the ability to retract as needed:

class Account extends Model
{
public function users()
{
return $this->hasMany(User::class)->orderBy('name');
}
}
// Remove the name orderBy and order by email
$account->users()->reorder()->orderBy('email');
// The same can be written as:
$account->users()->reorder('email');

Release notes

Below is the full list of new features and updates, and you can see the differences between 7.3.0 and 7.4.0 on GitHub. You can find all version notes for Laravel 7.x in the latest v7 change log:

v7.4.0

Added

  • make:policymake customizable Brings ( # 32040 , 9d36a36 )
  • HigherOrderWhenProxyApplication for Collections ( # 32148 )
  • Illuminate\Testing\PendingCommand::expectsChoice()# 32139 )
  • Added support for default values for the "props" blade tag ( #32177 )
  • Added Castableinterface ( # 32129 , 9cbf908 , 651371a )
  • Added the ability to remove orders from query builder ( #32186 )

constant

  • PendingMailFake::sendNow()and PendingMailFake::send()# 32093 ) has been added to the missing return
  • Pinning Custom Model Features ( #32118 )
  • Fixed route group ( #32135 , 870efef )

Updated

  • Remove Swift Mailer ties ( #32165 )
  • Add middleware.stub to files to be published while running Php artisan stub:publish# 32099 )
  • Php artisan stub:publish# 32100 ) add factory.stub to files to be published while running
  • Adding seeder.stub to files to be published while running Php artisan stub:publish# 32122 )

  Quote

KARABAY A, 2020 . Laravel 7.4.0 Out,

https://www.karabayyazilim.com/blog/php/framework/laravel/laravel-740-cikti-2020-04-02-155729

(Accessed April 02, 2020).


  Share this post

Comments (0)

Comment

Subscribe
Sign up for the email newsletter to be the first to know about my blog posts