Allow specifying the directory as part of the make:bag command
Is your feature request related to a problem? Please describe.
I'm unable to use the make:bag command and all of its features (particularly the --docs option) due to the App namespace being hard-coded in the command (line 72).
Describe the solution you'd like
I'd love to be able to use make:bag even if it's through an option to specify the directory rather than letting the package try to figure out the path to where my Bag file is.
php artisan make:bag ApplicationData --directory=domain/Applications/Data
Describe alternatives you've considered
I'm not sure there's an alternative since it's hard-coded and I use more of a domain-driven design directory structure.
Additional context
None.
If you specify the full classname it should put it in the correct directory, but it still assumes it's PSR-4 from the top level I believe.
Would you expect Collections and Factories to be in domain/Applications/Data/Collections and domain/Applications/Data/Factories?
I've tried a bunch of different things here to get it to work and none of them work the way I would expect. Previously I was being more generic about my application setup for brevity, but here are the specifics:
{
"autoload": {
"psr-4": {
"Nova\\": "nova/src/"
}
}
}
- nova
- src
- Applications
- Data
- ApplicationData.php
Here are the things I've done to try to get to the ApplicationData class and do the doc updates. Not sure if I'm missing something here or what you're suggesting as the solution, so if that's the case, I apologize.
Specifying the full classname and no namespace
php artisan make:bag Nova\\Applications\\Data\\ApplicationData --update --docs
After running this command, the namespace prompt comes up, I clear out the namespace and the following error happens:
Value 'Nova\Applications\Data\ApplicationData' is not valid class name.
ClassLike:89
Specifying the full classname minus the Nova namespace
php artisan make:bag Applications\\Data\\ApplicationData --update --docs
After running this command, the namespace prompt comes up, I enter Nova and the following error happens:
Value 'Applications\Data\ApplicationData' is not valid class name.
ClassLike:89
Specifying just the classname and using Nova in the namespace prompt
php artisan make:bag ApplicationData --update --docs
After running this command, the namespace prompt comes up, I enter Nova\Applications\Data. The command runs and puts a new file at nova/src/Nova/Applications/Data/ApplicationData.php. Close, but I don't need the Nova piece in there.
Specifying just the classname and using App in the namespace prompt
php artisan make:bag ApplicationData --update --docs
After running this command, the namespace prompt comes up, I enter App\Applications\Data. The following error happens:
Undefined array key "App\Applications\Data"
MakeBagCommand:181