Where to store module frontend views
I have a module and a front-end theme that are being developed together. The module deals with both backend and front-end. I have to create some pages using the module but am unsure where I should store the views for it.
I began creating them in the module Resources folder but realised I'd want to extend the themes layout to keep everything consistent.
Anyone able to offer any guidance?
Not entirely sure about that extend themes part, but you can store views anywhere you want and extend any other theme and/or module view.
Just seperate views in frontend/public and backend/admin folders and you are good to go.
Generally you would want Theme where you store layouts and partials and in module folder you store small pieces directly related to module.
If you could provide some example i can help you out with setup.
I may be approaching entirely the wrong way so apologies if thats the case. My module basically allows for ticket purchasing. The admin can create/edit ticket orders through the backend. Now I want the customers to be able order tickets on the front-end.
My first thought was to create views in the module specifically for purchasing tickets then
@extendthe theme layout but have realised I'd run into issues where the
$pagewont be available because I'd be manually dispatching the view through a controller rather than allowing the Page module to do it for me.
Would I create a new page template in the theme and include the purchasing html/js from the module?
Thanks for offering your help!
EDIT: I'd need to prevent guests from accessing the frontend purchase form - I'm unsure as to the best way to achieve this if I am creating the pages via the Page module.
I'd do as you first had it. Having the views in the module, and the controller rendering that view.
So about the
$page, it should be always available to you, just how the
Pagemodule route handling works.
I would store views that you mentioned purchasing of tickets, edit of ticket orders in the module itself separated by frontend/backend folders.
Layout and other website components shared across all website should go into Themes folder.
I feel like you are worrying too much about that Page module, the Page module will take care of incoming request and try to allocate appropriate master template for your page or in your case it will return
default.blade.php(probably should be configurable) as master layout and include
$pagevariable there. So you can just
@extend('default')in your module view.