3x1io / filament-excel

Excel Export for Resources for filament admin
MIT License
20 stars 4 forks source link

Subfolders are not supported #6

Open FrodeMMeling opened 1 year ago

FrodeMMeling commented 1 year ago

If I am using subfolders for Models, the ExportGenerator are not able to generate action in list Class.

Example: php artisan filament:export Cadmatic/LicenseAvailabilityResource Cadmatic/LicenseAvailability

when generating path to listResource, it becomes: app/Filament/Resources/Cadmatic/LicenseAvailabilityResource/Pages/ListCadmatic/LicenseAvailabilities.php

It should have been: app/Filament/Resources/Cadmatic/LicenseAvailabilityResource/Pages/ListLicenseAvailabilities.php

changing Line: 53 in ExcelGenerator.php class from $pluralModelName = Str::plural($modelName); to: $pluralModelName = Str::plural(substr($modelName,strripos($modelName, '/') + 1,strlen($modelName)));

will fix issue.. This will find last instance of '/' and extract the remaining string to the plural function

FrodeMMeling commented 1 year ago

there is also a namespacing issue in the generated Export Resource that needs adressing.. strreplace / with \