Customize stub with Module name placeholder
Opened this issue · 0 comments
masiorama commented
Hi there, I'm trying to customize stubs in order to create a controller which is kinda ready to work with inertia+vue.
The stub name is controller.inertia.stub
, inside stubs
directory in the root, and the content is something like this:
<?php
namespace {{ namespace }};
use {{ rootNamespace }}Http\Controllers\Controller;
use Inertia\Inertia;
use Inertia\Response;
class {{ class }} extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(): Response
{
return Inertia::render('[ModuleName]::index');
}
}
The executed command to generate the controller is php artisan make:controller NameController -r --module=[module name] --type=inertia
I don't know if this isn't the right approach but:
- the controller is generated,
- [ModuleName] is not replaced with the module name.
I tried applying some variations of this but had no luck.
Thanks for any suggestion.