flipboxstudio / lumen-generator

A Lumen Generator You Are Missing
https://packagist.org/packages/flipbox/lumen-generator
MIT License
824 stars 126 forks source link

Support for `php artisan stub:publish`? #110

Open simplenotezy opened 3 years ago

simplenotezy commented 3 years ago

I was wondering if we could get support for php artisan stub:publish?

yuliusardian commented 2 years ago

Yup, It is possible ! I think about it too.

We need to refactor the directory of loaded stubs file from each generator command into custom directory if exist and the fallback is the origin one.

For example :

At file :

src/LumenGenerator/Console/CastMakeCommand.php

There is protected getStub() function :

    /**
     * Get the stub file for the generator.
     *
     * @return string
     */
    protected function getStub()
    {
        return __DIR__.'/stubs/cast.stub';
    }

We should change something like :

    /**
     * Get the stub file for the generator.
     *
     * @return string
     */
    protected function getStub()
    {
        return (config('flipbox.stub.dir') ? config('flipbox.stub.dir') : __DIR__) . '/stubs/cast.stub';
    }