php - A ViewModel for a Contact Form in Laravel -
I'm not new to MVC, but I'm just starting with Laravel. In ASP.NET MVC we have ViewModels, which is basically a data object that we can pass from the scene. The view can then use ViewModel that wants it in any way.
What is such a thing in Laravel? I want to create a scenario that I can pass my contact view and make a form metric around it!
What do I currently have:
Route Administrators Besides, do not you see anything wrong with my routes and controller code? In ASP.NET MVC, we can put exact name with the same name as long as the actions are different (POST / GET). In my contact form 3 textfields (name, email and subject) and a texture (message). Any help would be greatly appreciated. Maybe you are talking about a Code> presenter . Route :: find ('/ contact', array ('As' = & gt; 'contact', 'usage' = & gt; 'home controller @ contact')); Root :: Post ('/ contact', array ('as' = & gt;' Contact ',' Usage '=> PostContact @ Home Controller'));
& lt ;? Expands Php Class Home Controller Base Controller {Public Function Contacts () {Return View :: Create ('Contact'); } Public event postContact () {$ formData = input :: all (); See Return: Creating ('Contact'); }}
view / model presenter Which is another layer between your
model and
view and in this case you can make your own or use the existing package: <
Comments
Post a Comment