igaster/laravel-theme

Included files not rendering after upgrade

Opened this issue · 2 comments

tayvc commented

I recently upgraded my project from Laravel 5.1 -> 6.x and also upgraded this theme package to 2.x following the migration instructions. My themes are definitely being set correctly with Theme::set($theme) however, any includes within my theme files no longer render. I am wondering if anyone else ran into this issue and if there is something I may have missed?

For example, this file has the following includes:
/resources/views/themes/theme1/templates/homepage-sweepstakes.blade.php

@include('includes.sweepstakes.portrait')
@include('includes.sweepstakes.you-can-win')

These files are located at:
/resources/views/themes/theme1/includes/sweepstakes/portrait.blade.php
/resources/views/themes/theme1/includes/sweepstakes/you-can-win.blade.php

And my themes config accurately sets the view paths to the following:

$paths = [
                realpath(base_path('resources/views/themes/theme1)),
                
                realpath(base_path('resources/views/themes/default')),
                
                realpath(base_path('resources/views')),
            ];

But I am getting the following error on page load:
"View [includes.sweepstakes.portrait] not found."

Any help is greatly appreciated! :)

tayvc commented

I was looking through some older issues and found that my app('view.finder') is no longer returning the themeViewFinder class, but the default FileViewFinder one. Any ideas as to why this would have changed after updating the package to 2.x and Laravel to 6.x?

This is strange! Is the package auto-discovered when you run "composer dump-autoload"?

If you migrated from old version, then pay attention that package namespace capitalization has been updated... Check your imports if you missed something. Also on Windows systems, paths might not be updated. I would suggest that you remove the package from your vendors directory, and run "composer install" to get a fresh installation...