Download the PHP package kregel/formmodel without Composer
On this page you can find all versions of the php package kregel/formmodel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package formmodel
Config file
What this code does, is, if there is a relationship, but it will return the resolved relationship function's evaluation. So if you want to scope this down some, then be my guest.
Custom frameworks.
The next step is to change the way your framework interacts with the modelInput method. There is a new "base" framework impementation, which draws from something only some classes had which is the automatic relationship resolution. If you extend the Plain framework then you will be able to use this feature by default. Other wise you can keep doing what you're doing :)
If you need custom attributes on your form inputs like v-models
(for vue) or some other javascript framework or you want to add custom classes, It's recommended that your framework only contain methods that relate to the inputs for that framework, and to not have them override the default modelInputs
method
Oh crap! an update broke my App!! WHAT DO I DOOO!? FIX IT NOW!!
Please, before you raise a lynch mob on Twitter, use your brain and the wonderful human powers of deductive reasoning.
So, as of 2.0, there was a huge structure change with... Well, everything. I made the whole system a bit more modular and extensible. So instead of needing to create a new instance of your model AND FormModel, now you just need to new up a FormModel instance. Or... If you have our facade set up, you can use the facade.
What is this package?
This package was created to help decrease the time it takes to echo out a form relating to a given Model while still giving the developer the ultimate amount of flexibility .
What do I need to do to make it work?
To get it to work properly, similar to how it works in my Warden package, it's recommended to do the following
-
composer require kregel/formmodel or add
"kregel/formmodel":"^2.0"
to your composer.json file, just be sure to usecomposer update
with that statement, or if you haven't build your dependancies usecomposer install
instead. -
Register the service provider with your
config/app.php
file -
(optional) Add the alias to your
config/app.php
file - Publish the config file! This should be able to be done with
php artisan vendor:publish
-
Use your favorite way to new up a FormModel, this can be done using the Facade or by just doing
-
Use something similar to the following in your controller, or in your view (maybe you injected it?)
- Print the results!
Do you have an example?
Duhh! Let it be known that this is a method in one of the controllers from my Warden package.
Extending
You can extend this system just like you would with my Menu Package. In the section in the config labeled 'custom-framework'. Modify the Namespacing of the newed up object to your class and it should just work (assuming you knew to use the structure of the class below)
Questions?
Email me (my email is on my github page), or you can drop an issue. :)