Skip to content

Customize stub with Module name placeholder #104

@masiorama

Description

@masiorama

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions