I have the following controller action in which I am creating a dynamic model.
The idea is a simple view use to generate a report and I need to have 2 fields to allow the user to specify a Start and End date to base the report on.
In a general sense, this work, but the labels remain StartDt and EndDt which is less than ideal. I know I can add ->label() to the view form fields, … but was wondering if there was a better approach.
Is there a simple way to set the Attribute Labels in the controller while I am creating the model?
Any advice on working with Dynamic Models? Should I be doing the reporting another way, is a Dynamic model the wrong choice here?
there is a way to inject the Attribute labels into the ActiveField (if you use a ActiveForm to render Inputfields). But i think, you should either use ->label() or write a Model. Anyways, here the answer to your Question:
Thank you both. It took a bit of fiddling, but I created a Model and everything seems to be in order. I thought a model had to be tied to a table. This opens a lot of possibilities and makes my life much easier.