Laravel now supports four ways to register authorization policies:
🧾 Legacy: AuthServiceProvider
🛠️ Manual: Gate::policy()
🔍 Discovery: Follows naming conventions
✨ Attribute-based (new in 12.18): #[UsePolicy(...)]
Cleaner, more flexible, and built for modern PHP.
•
Working with nested JSON in a Laravel model?
Used to mean verbose array access, constant merging, and offset warnings
Now in Laravel 12.19+:
✅ Use AsFluent cast
✅ No more manual merges
✅ No more “undefined offset” errors
✅ Just clean, expressive syntax
•