Contact form

  • How can I add a basic contact form to the front end? Fill in fields, validate and send email.

  • First, create a new template to frontend theme (Themes/Flatly/views) like home.blade.php. after include your contact form to the template.

    Create a new page with the new template.

  • Thanks for the reply. I can alter a theme and display a form/fields etc I am confused on how to process that (Asgard Routes).
    Going through the Asgard youtube examples, they are all focused on creating backend content and presenting that on the front end.
    A front end form could be doing the opposite capturing the data and displaying it in the backend.
    I'd like a contact form that sends an email but also is captured to the database in case the email dies or something. The backend would simply display the data (not edit).
    I guess I just don't understand how to make the routes work in this direction as I have not seen an Asgard example of it.

  • Miraculously I have figured this out. I might not be the sharpest tool in the shed but I am tenacious.
    Will update post with what I did when time permits, will probably need to come back to it myself in the future.

  • Global Moderator

    What you would probably do is make new Module for Asgard, either standalone Contact Form or in conjunction with some other context.
    From there on you would fill out frontend and backend routes as well as validation and entities, also adding new sidebar entry for your comments in backend.

    You could basically follow by example from Page module thats in Asgards platform installation, it should provide all puzzle pieces that you can salvage for your own module.

    For actual transitional mailing you would look up offical Laravel 5.1 documentation and fill in appropriate driver information in your configs.

  • @armababy thank you, that is essentially what I have now done.
    I followed the testimonials youtube tutorial (Creating a Module:Frontend) making changes as required for my content.
    Added a {module}\http\frontendRoutes.php file. Altered the {module}\providers\RouteServiceProvider.php to include the front end route file.
    Added a {module}\Http\Controllers{controller} file to handle the actual storage / sending, the storage part being esentially the same as the Admin controller store() method from the above tutorial. Obviously simple for those in the know but I'm happy to have nutted it out.

Log in to reply

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.