Published in
Aug 10, 2024
# Add Generics to Eloquent Builder and Relations
主要在於讓 IDE 可以更好的解析 Eloquent relations,有助於 auto-completion,細節請參考 PR
# Prompt for Creating a View with make:mail
11.15 新增了 artisan make:mail
command 的 prompt,簡單的 Demo 可參考 影片
# Make Router Tappable
11.15,Router class 支援 Tappable trait
<?php
class RouteRegistrar
{
public function __invoke(Router $router)
{
$router->post('redacted', WebhookController::class)
->name('redacted');
}
}
$router
->tap(new Redacted1Webhooks\RouteRegistrar())
->tap(new Redacted2Webhooks\RouteRegistrar())
// ...
;
// In tests...
protected function defineRoutes($router)
{
$router->tap(new \RedactedWebhooks\RouteRegistrar());
}
# Updates to Database Migrations
11.15 針對 SQLite 做了一些優化如下,細節可參考 RP
- Extend SQLite support to 3.26+
- Add and Drop Foreign Keys on SQLite
- Add and Drop the primary key on SQLite
- Preserve the order of commands
- Blueprint State for SQLite
# Support for MIME Types in Resend Mail Transport
11.15 針對 Resend mailable class 新增 attachment MIME type 設定,細節參考 PR
<?php
public function attachments(): array
{
return [
Attachment::fromPath('/path/to/file')
->as('name.pdf')
->withMime('application/pdf'),
];
}