leandrocfe / filament-apex-charts

Apex Charts integration for Filament PHP.
https://filament-apex-charts-demo.leandroferreira.dev.br
MIT License
300 stars 38 forks source link

Fix stub path for non-Windows environments #1

Closed jcandan closed 1 year ago

jcandan commented 1 year ago

Problem

The following exception occurs:

file_get_contents(/app/vendor/leandrocfe/filament-apex-charts/src/CommandsLine.stub): Failed to open stream: No such file or directory

Steps to reproduce

Within a Linux container, run php artisan make:filament-apex-charts BlogPostsChart.

Proposed resolution

It is my understanding that Windows supports forward slashes.

Update getStubPath to use forward slashes:

        $path = Str::of(__DIR__)
            ->replace('src/Commands', 'stubs/')

If this does not work on Windows, then this works too:

        $path = Str::of(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR)

Though, judging by FortifyServiceProvider.php, this seems like the way to go:

        $path = Str::of(__DIR__.'../../stubs/')
leandrocfe commented 1 year ago

Thank you. Fixed: https://github.com/leandrocfe/filament-apex-charts/releases/tag/0.1.2