spatie / laravel-data

Powerful data objects for Laravel
https://spatie.be/docs/laravel-data/
MIT License
1.28k stars 208 forks source link

Optimize exception when app/Data doesn't exist #892

Open JasperTey opened 2 hours ago

JasperTey commented 2 hours ago

✏️ Describe the bug Optimize command data:cache-structures fails if app/Data directory doesn't exist.

This issue surfaced as a result of the recent registration of optimize commands introduced in #880, while running php artisan optimize in production. The app in question does not store data objects inside app/Data and therefore the folder didn't exist.

↪️ To Reproduce

✅ Expected behavior Gracefully continue if app/Data doesn't exist.

🖥️ Versions

Laravel: 11.29.0 Laravel Data: 4.11.0 PHP: 8.3.12

JasperTey commented 2 hours ago

Wanted to report this issue for now and get eyes on it. I will try to work on a PR later when I have some time. If anyone else can get to it sooner, that's great too.