Sunday, October 2, 2022
HomePHPLaravel 9.30 Launched | Laravel Information

Laravel 9.30 Launched | Laravel Information


The Laravel crew launched 9.29 and 9.30 with a read-only filesystem possibility, a scoped filesystem driver, the flexibility to discard mannequin modifications, and extra.

Word: we final lined Laravel 9.28.0, so this launch submit covers each 9.29 and 9.30.

Learn-only filesystem config possibility

Frank de Jonge contributed to configuring a filesystem disk to function in read-only mode. This ensures no write operations are attainable on the disk, which is helpful when accessing storage you need to guarantee would not manipulate any recordsdata.

This is a config instance from the pull request for this characteristic:

1$disk = $filesystem->construct([

2 'driver' => 'local',

3 'read-only' => true,

4 'root' => 'my-custom-path',

5 'url' => 'my-custom-url',

6 'visibility' => 'public',

7]);

Scoped filesystem driver

Frank de Jonge contributed scoped filesystem drivers, which allows a strategy to reuse disk configurations. This is an instance from the pull request description:

1[

2 's3' => [

3 'driver' => 's3',

4 'key' => env('AWS_ACCESS_KEY_ID'),

5 'secret' => env('AWS_SECRET_ACCESS_KEY'),

6 'region' => env('AWS_DEFAULT_REGION'),

7 'bucket' => env('AWS_BUCKET'),

8 'url' => env('AWS_URL'),

9 'endpoint' => env('AWS_ENDPOINT'),

10 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),

11 'throw' => false,

12 ],

13 's3_videos' => [

14 'driver' => 'scoped',

15 'prefix' => 'path/for/videos',

16 'disk' => 's3',

17 ],

18]

Add drive choice to all “make” instructions

James Brooks contributed a --force flag to all make:* instructions, which is useful when that you must recreate a file.

“Required if accepted” validation rule

Pascal Baljet contributed a required_if_accepted validation rule which ensures the sector beneath validation is required if one other discipline is accepted (a price of sure, on, 1, or true):

1Validator::make([

2 'is_company' => 'on',

3 'company_name' => 'Apple',

4], [

5 'is_company' => 'required|boolean',

6 'company_name' => 'required_if_accepted:is_company',

7]);

Skill to discard Eloquent mannequin modifications

Mior Muhammad Zaki contributed a discardChanges() technique to discard attribute modifications and reset attributes to their unique state:

1$consumer = new EloquentModelStub([

2 'name' => 'Taylor Otwell',

3]);

4 

5$consumer->getOriginal('identify'); // null

6 

7$consumer->getAttribute('identify'); // Taylor Otwell

8$consumer->discardChanges();

9$consumer->getAttribute('identify'); // null

Decide if attachments exist

Andrew Minion contributed to figuring out if the given attachments are included in a mailable. Three strategies have been added that may assist assert attachments in checks:

1$mailable = new InvoicePaid($consumer);

2 

3// Check regular attachment.

4$this->assertTrue(

5 $mailable->hasAttachment('Receipt.pdf')

6);

7 

8// Check attachment from storage disk.

9$this->assertTrue(

10 $mailable->hasAttachmentFromStorageDisk('s3', 'invoices', $consumer->latest_invoice->identify)

11);

12 

13// Check uncooked attachment.

14$this->assertTrue(

15 $mailable->hasAttachedData('12345', 'affirmation.txt')

16);

Launch Notes

You possibly can see the whole listing of recent options and updates under and the diff between 9.28.0 and 9.30.0 on GitHub. The next launch notes are straight from the changelog:

v9.30.0

Added

  • Added stop_buffering config choice to logger (#44071)
  • Added read-only filesystem adapter ornament as a config possibility (#44079)
  • Added scoped filesystem driver (#44105)
  • Add drive choice to all make instructions (#44100)

Mounted

  • Mounted QueryBuilder whereNot with array situations (#44083)

Modified

  • Passing occasion into viaQueue and viaConnection of Queued Listener (#44080)
  • Enhance testability of batched jobs (#44075)
  • Permit any form of whitespace in cron expression (#44110)

v9.29.0

Added

  • Added RequiredIfAccepted validation rule (#44035)
  • Added Illuminate/Basis/Vite::assetPath() (#44037)
  • Added skill to discard Eloquent Mannequin modifications (#43772)
  • Added skill to find out if attachments exist to Illuminate/Mail/Mailable (#43967)
  • Added Illuminate/Assist/Testing/Fakes/BusFake::assertNothingBatched() (#44056)

Reverted

Mounted

  • Keep away from Passing null to parameter exception on PHP 8.1 (#43951)
  • Align Keep in mind Me Cookie Period with CookieJar expiration (#44026)
  • Repair Stringable typehints with Enumerable (#44030)
  • Mounted middleware “SetCacheHeaders” with file responses (#44063)

Modified

  • Do not use locks for queue job popping for PlanetScale’s MySQL-compatible Vitess engine (#44027)
  • Keep away from matching ‘use’ in customized Stub templates in Illuminate/Console/GeneratorCommand.php (#44049)
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments