My Blog Posts

Laravel 7.15 Released

Laravel 7.15 Released


The Laravel team released v7.15.0 with a test assistant, a new model method to define relationships between models.

Expandable Relationships for Models

Gergő D. NagyresolveRelationUsing a method that enables defining relationships between models from outside model class definitions AddDi:

Order::resolveRelationUsing('customer', function ($model) {
return $model->belongsTo(Customer::class, 'customer_id');
});

WithToken (Test Assistant)

Aryeh RaberwithToken() HTTP contributed to the test assistant:

Using withHeader
$response = $this->withHeader('Authorization', 'Bearer test_token')->postJson('/some-endpoint');
// The new withToken () helper
$response = $this->withToken('test_token')-postJson('/some-endpoint');

Foreign UUID

Paul AdamsforeignUuid() contributed to the definition of a column for UUID foreign keys. Here are some examples of tests of pick request:

$table->foreignUuid('company_id'company_id')-constrained();
$table->foreignUuid('laravel_idea_id'laravel_idea_id'-constrained();
$table->foreignUuid('team_id')-references('id')-'on('teams');
$table-foreignUuid('team_column_id')-constrained('teams');

Release notes

Below you can see the full list of new features and updates and the difference between 7.14.0 and 7.15.0 on GitHub.

v7.15.0

Added

  • Added expandable relationships for models ( #33025 )
  • Illuminate\Foundation\Testing\Concerns\MakesHttpRequests::withToken()# 33075 , 79383a1 )
  • Illuminate\Database\Eloquent\Relations\HasOneOrMany::makeMany()(creating a large number without saving) ( # 33021 )
  • Illuminate\Database\Schema\Blueprint::foreignUuid()# 33129 )
  • Event handler queue viaQueue()to be set up by method ( # 32770 , 852a927 )

Fixed

  • Model::withoutEvents()Fixed an issue where listeners were not booted and saved into () ( # 33149 , 4bb32ae )



Share this article


Comments (0)

Comment