pwweb / artomator

Artomator: Custom commands making life easier for Laravel.
MIT License
4 stars 1 forks source link

artomator:controller should take controller name in case no model is passed #2

Closed frankpde closed 5 years ago

frankpde commented 5 years ago

The command artomator:controller checks whether a corresponding model exists. In case it does not, the user is asked whether the model should be generated or not. In case the user decides not to create the model (for whatever valid reason), the controller is created, but the views being loaded are missing the model prefix:

Expected result: return view('controllerName.index')

Actual result: return view('.models.index')

Additionally it would need to be considered what to do with the comments, or the model instantiation in the function store(), destroy() and update().

rabrowne85 commented 5 years ago

Suggest that we remove the check and make it mandatory to make the model - thoughts?

frankpde commented 5 years ago

Would disagree- what if I want to create a controller that does not have a 1-1 relationship with a model?

rabrowne85 commented 5 years ago

Trying to think of an example of a controller that doesn’t have a model.

That being said if that’s the thought then we could add a simple check to see if the model has been defined and alter the replacements to suit.

Alternatively, we could look at introducing a different stub file?