Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for publishing view files that has its custom namespace #69

Merged
merged 4 commits into from Oct 11, 2022

Conversation

askdkc
Copy link
Contributor

@askdkc askdkc commented Oct 10, 2022

When your package view uses custom namespace, published view ignores the namespace and keeps using its package name for vendor-view's directory name.

For example, imagine you create a package that has some sort of image gallery. And you choose 'laravel-images' for your package view's namespace.

Now someone downloaded your package then decided to customize the views. So the person ran php artisan vendor:publish command to publish the views from this package.

But according to this sources laravel-package-tools uses package name for its base_path and namespace and ignoring actual view namespace which the package creator specified.

So no matter how the user modifies the published views, Laravel couldn't find the published view files.

This PR provides a fix for this problem.

When using namespaces, published view ignores namespaces and use its package name for vendor-view's directory name
src/PackageServiceProvider.php Outdated Show resolved Hide resolved
Copy link
Contributor Author

@askdkc askdkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freekmurze OK. I just avoid if-else statement and also added test for this

@freekmurze freekmurze merged commit c377cc7 into spatie:main Oct 11, 2022
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants