Skip to content

Laravel 13 - #44

Open
nicollassilva wants to merge 16 commits into
mainfrom
chore/laravel-13
Open

Laravel 13#44
nicollassilva wants to merge 16 commits into
mainfrom
chore/laravel-13

Conversation

@nicollassilva

Copy link
Copy Markdown
Collaborator

No description provided.

Framework-agnostic fixes, isolated in their own commit so that a breakage
here is not mistaken for a framework breakage later:

- articles.content migration: declare nullable(false) explicitly, since
  Laravel 11 onwards change() drops attributes that are not restated
- PasswordValidationRules: swap the deprecated Laravel\Fortify\Rules\Password
  (removed in Fortify 2.x) for Illuminate\Validation\Rules\Password::defaults(),
  matching what UserSettingController already used
- AppServiceProvider: View::share() -> View::composer('*'), so neither the
  database nor the request is touched while the container is still booting
- AdminPanelProvider: move getSetting() out of panel(), which is what
  filament:cache-components serializes; brandLogo/topNavigation become
  closures and defaultThemeMode moves to Filament::serving()
Laravel 11 is skipped on purpose: Composer 2.10 refuses to install any
v11.x release because the whole branch is out of security support and
carries unpatched advisories. Laravel 11 has no application-level breaking
changes over 12 for this codebase, so 10 -> 12 applies the same guide.

Dependency bumps:
- php ^8.1 -> ^8.2, laravel/framework ^10.8 -> ^12.0
- laravel/sanctum ^3.2 -> ^4.0, symfony/html-sanitizer ^6.4 -> ^7.0
- nunomaduro/collision ^7.0 -> ^8.0, phpunit/phpunit ^10.1 -> ^11.0
- flowframe/laravel-trend ^0.1.5 -> ^0.5 (0.1.x caps at illuminate ^10)
- filament stays on 3.x and floats to 3.3.54, which supports Laravel 12/13

Code changes:
- config/sanctum.php: adopt the v4 shape (token_prefix, authenticate_session,
  validate_csrf_token). personal_access_tokens already had expires_at.
- Carbon 3 no longer parses a numeric *string*, only a numeric value. Four
  call sites read unix timestamp columns that bypass model casts, so they
  now use createFromTimestamp(): Camera::getFriendsWhoHaveStories and the
  my-profile / my-groups / my-friends home widgets.
- PHP 8.4 implicit-nullable deprecations: HomeItemType, ShopOrderStatus,
  ShopProductItemType and ArticleController now use explicit ?Type
- ArticleController: move Request ahead of the optional route params in
  toggleReaction, drop the unused Request from toggleAuthorNotifications

composer update still needs --ignore-platform-req=php until Filament 4:
bezhansalleh/filament-language-switch 3.1.1 caps PHP at ^8.3.
Dependency bumps:
- php ^8.2 -> ^8.4, laravel/framework ^12.0 -> ^13.0 (13.25.0)
- laravel/tinker ^2.8 -> ^3.0, laravel/fortify ^1.17 -> ^1.38
- srmklive/paypal ~3.0 -> ^3.1, cyrildewit/eloquent-viewable ^7.0 -> ^7.1
  (not ^8.0: that release requires PHP ^8.5)
- symfony/html-sanitizer ^7.0 -> ^7.4|^8.0
- phpunit ^11 -> ^12, debugbar ^3.8 -> ^4.4, ignition ^2.0 -> ^2.12

Drop coderflex/filament-turnstile for coderflex/laravel-turnstile ^2.2.
The Filament wrapper hard-blocked Laravel 13 (it caps at illuminate ^12)
and was never referenced: App\Rules\TurnstileCheck only ever used
Coderflex\LaravelTurnstile\Facades\LaravelTurnstile, from the base package.

CSRF middleware rename. Illuminate's VerifyCsrfToken is now a deprecated
alias of PreventRequestForgery, so App\Http\Middleware\VerifyCsrfToken
becomes App\Http\Middleware\PreventRequestForgery, with the references in
Kernel.php, routes/web.php, config/sanctum.php and AdminPanelProvider
updated. The new Sec-Fetch-Site check is an extra way to pass, not a new
restriction, and $originOnly defaults to false, so the axios logins and
registrations still fall through to the token check as before.

config/cache.php documents why serializable_classes is deliberately left
unset instead of taking the skeleton's `false`: Navigation::getNavigations,
RankingController and HasCacheableWidgets all cache Eloquent objects, which
`false` would decode into __PHP_Incomplete_Class.

Route count goes 159 -> 158 because Debugbar 4 merged its two asset routes
into one. No application route changed.
Filament 4.12.6 supports illuminate ^11.28|^12.0|^13.0 and keeps Livewire on
^3.5, so this is one major hop rather than the 3 -> 4 -> 5 + Livewire 4 that
Filament 5 would require. It is also the only target where every plugin has a
compatible release: filipfonal/filament-log-manager has no v5 build at all.

Plugins:
- bezhansalleh/filament-language-switch ^3.0 -> ^5.0. v5 renamed the namespace
  from BezhanSalleh\FilamentLanguageSwitch to BezhanSalleh\LanguageSwitch; the
  locales()/labels()/flags() API is unchanged. (v4.x was not an option here:
  it caps at illuminate ^12.)
- filipfonal/filament-log-manager ^2.0 -> ^3.0

Automated pass: vendor/bin/filament-v4, which covers the Schemas namespace
unification, Tables\Actions -> Actions, Table::actions -> recordActions,
$navigationIcon/$navigationGroup retyping and static -> instance $view.
Two deviations were needed to get it to complete:
- Rector's parallel worker pool dies partway through on Windows, leaving the
  codebase half-migrated, so it ran with disableParallel().
- Rector 2.6 turned AddInterfaceByTraitRector into a hard error. Dropping it is
  safe here: it would only add `implements HasActions`, and the single class
  using InteractsWithForms (BadgePage) extends Page -> BasePage, which already
  implements HasActions and uses InteractsWithActions.

Manual fixes the script cannot make:
- CKEditor: Filament 4 deleted Forms\Components\Contracts\HasFileAttachments
  (the concern remains), which was a fatal on autoload.
- ck-editor.blade.php: the v4 field-wrapper dropped the helperText/hint/hintIcon
  props and $getHelperText() no longer exists, so the old wrapper call threw at
  render time. Passing :field lets the wrapper derive everything itself.
- LogsManager: the v3 plugin replaced $view with getView() and swapped the
  `search` form for content(Schema). The custom blade was structurally identical
  to the plugin's own view apart from utility classes, and the plugin now ships
  CSS for its classes, so it is dropped along with the now-redundant
  getFormSchema() override. getLogs() keeps its notification handling.
- AppServiceProvider: restore the v3 defaults v4 changed - Grid/Section/Fieldset
  spanning the full row, filters applying without an extra click, and 'all' in
  the pagination options. Components that set these explicitly still win.
- AdminPanelProvider: Filament's own AuthenticateSession instead of Illuminate's.
- config/filament.php: pin the make:filament-* generators to the v3 file layout
  so generated code matches the ~120 existing files.
- Filament 4 no longer compiles Tailwind utilities used in application-owned
  panel views, so user-avatar and the CKEditor disabled state move to explicit
  rules in the already-loaded public/assets/css/filament.css.

Dead code removed while here: app/Filament/Filters/DateRangeFilter (zero
references), the HasRoleName import in BadgePage (namespace never existed), and
Login::getFormSchema, which referenced an unimported Checkbox and is called by
no Filament version. Note App\Filament\Pages\Login has no route: the panel never
calls ->login() on it.

Also renames WordfilterPolicy.php to WordFilterPolicy.php - the case mismatch
made Composer skip the class on every dump-autoload.

Verified: 281/281 classes under app/ resolve, all Blade templates compile,
filament:cache-components builds the panel, route:cache and config:cache pass,
and all 9 locales of the log-manager overrides carry all 13 upstream keys.
Vite 4 and laravel-vite-plugin 0.7 are far behind what Laravel 13 pairs with.
Matching the 13.x skeleton:

- vite ^4.0.0 -> ^8.0.0
- laravel-vite-plugin ^0.7.2 -> ^3.1 (peers on vite ^8)
- sass ^1.62 -> ^1.80 for the modern JS API that Vite 7+ requires
- postcss and autoprefixer to current patches

Tailwind stays on 3.x on purpose. The 13.x skeleton moved to Tailwind 4, but
tailwind.config.js carries custom spacing, fontSize, bottom and colors.slate.850
plus the forms and typography plugins, so that migration belongs in its own PR.

vite.config.js needs no change: outDir, transformOnServe and the @public /
@packages aliases all still work. Verified by a clean build producing all three
entrypoints (app.scss, app.js, client.js) and a manifest.

The "didn't resolve at build time" warnings for /assets/images/* are expected -
those paths are served from public/ and are what transformOnServe rewrites.

Note yarn.lock is kept in the v1 (classic) format it was already in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant