Urgent.News

What's breaking now, across thousands of outlets.

Tech

PHP Attributes in Laravel 13: goodbye to sparse properties in models

Il problema delle property sparse nei modelli Eloquent Fino a Laravel 12, configurare un modello Eloquent significava definire proprietà come $table , $fillable , $hidden , $casts e $primaryKey sparse nel corpo della classe. Con modelli complessi — quelli con decine di campi, relazioni multiple e accessor personalizzati — queste dichiarazioni si mescolano a relazioni e metodi, rendendo il codice…

Translated from Italian Read in Italian

Laravel 13 introduces native PHP Attributes as an optional alternative to traditional properties for configuring Eloquent models. This change allows for a more compact and readable way of declaring model configurations, such as table names, fillable fields, and casts, using PHP 8.1+ syntax. The Attributes can be used in over 15 areas of the framework, including models, controllers, jobs, and notifications, and do not impact performance.

The old property syntax remains fully supported, and migration can be done incrementally. IDEs and static analysis tools, such as PhpStorm, VS Code, and PHPStan, already support Laravel 13 Attributes.

Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

This startup wants to turn idle user car inventory into rental revenue

When Igor Dobrianskyi looks at a car dealership lot, he doesn't see rows of cars — he sees millions of dollars just sitting there, depreciating, while people who only need a car for a few months are…

  • MyMonthlyCar connects idle cars with renters through online platform
  • Startup founded by Ukrainian co-founders Igor, Kostiantyn, and Vadym
  • Aims for 100 dealerships, $42M revenue in 5 years

pwasm 0.2a0

Release: pwasm 0.2a0 pwasm is one of my folly projects - an entirely vibe-coded pure Python WebAssembly engine that I built in January during my first bout of AI mania .

Database Indexing & Query Performance

⚡ TL;DR: Understand why a query instant at 1,000 rows times out at 10 million. Use indexes where they help (and skip them where they hurt), read an EXPLAIN plan to see what the planner chose, and kill…

  • Orders table grew from 1,000 to 10 million rows
  • Database performed full scan instead of using index
  • Query performance degraded from instant to 8 seconds

More from Thursday 1 October →