Popular stacks like Laravel + Inertia have a differerent way of rendering pages.
Currently the only supported statement is render which creates a blade view file.
I would suggest creating a statement that can generate the code that supports inertia rendering syntax.
For example render_inertia.
I tried to implement this by creating a blueprint extension however quickly realised that the statements are within the ControllerGenerator. To solve this I had to basically copy over the entire controller generator and add the inertiaJS statement at the end of the else if statements on line 184 in src/Generators/ControllerGenerator.php.
Right now my own version of the ControllerGenerator works for me however I am willing to extend the controller generator to support the inertia render command for everybodies use.
Proposed Syntax:
controllers:
CustomerController:
resource: show
show:
render_inertia: customer.show with:Customer
Expected Behavior:
public function show(Request $request, Customer $customer):
{
return Inertia::render('Customer/Index', ['customer' => $customer]);
}
I'm all for this as I'm currently working on adding Livewire support. So I'd be open to a inertia statement. Feel free to draft up a PR. Otherwise, I'll try to get to this in the coming weeks.
Synopsis:
Popular stacks like Laravel + Inertia have a differerent way of rendering pages. Currently the only supported statement is
render
which creates a blade view file.I would suggest creating a statement that can generate the code that supports inertia rendering syntax. For example
render_inertia
.I tried to implement this by creating a blueprint extension however quickly realised that the statements are within the ControllerGenerator. To solve this I had to basically copy over the entire controller generator and add the inertiaJS statement at the end of the else if statements on line 184 in
src/Generators/ControllerGenerator.php
.Right now my own version of the ControllerGenerator works for me however I am willing to extend the controller generator to support the inertia render command for everybodies use.
Proposed Syntax:
Expected Behavior:
What does the community think? Thank you
Tags: