CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

17 October, 2022

Laravel 9.35 Released

 Programing Coderfunda     October 17, 2022     Laravel, php     No comments   

 The Laravel team released 9.35 with an exciting new alternate mailable syntax, an Eloquent "strict mode" feature, and more.

Alternate mailable syntax

Taylor Otwell contributed an alternate mailable syntax to works by returning "slim value objects that specify the content and attributes of the mailable"

Here's an example from his pull request description:

1namespace App\Mail;
2 
3use Illuminate\Bus\Queueable;
4use Illuminate\Contracts\Queue\ShouldQueue;
5use Illuminate\Mail\Mailable;
6use Illuminate\Mail\Mailables\Address;
7use Illuminate\Mail\Mailables\Attachment;
8use Illuminate\Mail\Mailables\Content;
9use Illuminate\Mail\Mailables\Envelope;
10use Illuminate\Queue\SerializesModels;
11 
12class InvoicePaid extends Mailable
13{
14 use Queueable, SerializesModels;
15 
16 /**
17 * Create a new message instance.
18 *
19 * @return void
20 */
21 public function __construct()
22 {
23 //
24 }
25 
26 /**
27 * Get the message envelope.
28 *
29 * @return \Illuminate\Mail\Mailables\Envelope
30 */
31 public function envelope()
32 {
33 return new Envelope(
34 subject: 'Invoice Paid',
35 cc: [new Address('foo@example.com', 'Example Name')],
36 tags: [],
37 metadata: [],
38 );
39 }
40 
41 /**
42 * Get the message content definition.
43 *
44 * @return \Illuminate\Mail\Mailables\Content
45 */
46 public function content()
47 {
48 return new Content(
49 view: 'html-view-name',
50 text: 'text-view-name',
51 );
52 }
53 
54 /**
55 * Get the attachments for the message.
56 *
57 * @return \Illuminate\Mail\Mailables\Attachment[]
58 */
59 public function attachments()
60 {
61 return [
62 Attachment::fromPath('/path/to/file'),
63 ];
64 }
65}

The traditional way of defining mailables using build() will not be removed. I like how the above example is obvious what is happening using PHP 8's named arguments.

Eloquent "strict" mode

Chris Morrell and Taylor Otwell collaborated on an Eloquent strict mode, which enables the following:

  • No lazy loading
  • Exceptions when assigning non-fillable attributes
  • Exceptions accessing attributes that weren't retrieved or didn't exist

Ideally, you'll use strict mode in development by adding the following to the boot() method of a registered service provider:

1Model::shouldBeStrict();

The shouldBeStrict() method is a shortcut for enabling all of the following:

1Model::preventLazyLoading();
2Model::preventSilentlyDiscardingAttributes();
3Model::preventsAccessingMissingAttributes();

Load trashed models with resource routes

Andrew Brown contributed the ability to load trashed models with resource routes using the following routing syntax:

1// All endpoints
2Route::resource('users', UserController::class)->withTrashed();
3 
4// Only `show`
5Route::resource('users', UserController::class)->withTrashed(['show']);

Release Notes

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

v9.35.0

Added

  • Allow loading trashed models for resource routes (#44405)
  • Added Illuminate/Database/Eloquent/Model::shouldBeStrict() and other (#44283)
  • Controller middleware without resolving controller (#44516)
  • Alternative Mailable Syntax (#44462)

Fixed

  • Fix issue with aggregates (withSum, etc.) for pivot columns on self-referencing many-to-many relations (#44286)
  • Fixes issue using static class properties as blade attributes (#44473)
  • Traversable should have priority over JsonSerializable in EnumerateValues (#44456)
  • Fixed make:cast --inbound so it's a boolean option, not value (#44505)

Changed

  • Testing methods. Making error messages with json_encode more readable (#44397)
  • Have 'Model::withoutTimestamps()' return the callback's return value (#44457)
  • only load trashed models on relevant routes (#44478)
  • Adding additional PHP extensions to shouldBlockPhpUpload Function (#44512)
  • Register cutInternals casters for particularly noisy objects (#44514)
  • Use get methods to access application locale (#44521)
  • return only on non empty response from channels (09d53ee, 3944a3e)
  • Correct channel matching (#44531)
  • Migrate mail components (#44527)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Features CodeIgniter
    Features CodeIgniter There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advan...
  • Laravel Breeze with PrimeVue v4
    This is an follow up to my previous post about a "starter kit" I created with Laravel and PrimeVue components. The project has b...
  • Fast Excel Package for Laravel
      Fast Excel is a Laravel package for importing and exporting spreadsheets. It provides an elegant wrapper around Spout —a PHP package to ...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda