caffeinated / themes

:art: Laravel Themes package with support for the Caffeinated Modules package.

Home Page:https://caffeinatedpackages.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install Error

laughingpain opened this issue · comments

> @php artisan package:discover


  [LogicException]
  You must call one of in() or append() methods before iterating over a Finder.


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

fresh laravel 5.5.13 on WAMP with PHP 7.1

This also happens on a fresh Laravel 5.4.36

From what I could tell, it has to do with trying to traverse the themes folder during service registration when that folder hasn't yet been created. Changing the singleton registration to the following apparently fixes the issue:

$this->app->singleton('caffeinated.themes', function($app) {
    $themes = [];
    $items  = [];

    if ($path = config('themes.paths.absolute')) {
        if (file_exists($path) && is_dir($path)) {
            $themes = $this->app['files']->directories($path);
        }
    }

    foreach ($themes as $theme) {
        $manifest = new Manifest($theme.'/theme.json');
        $items[] = $manifest;
    }

    return new Theme($items);
});