lundi 8 avril 2019

Laravel package development - config file not located

I'm learning how to create own package according to laravel docs. I have a problem with configuration file. Below is the code of my KasiaServiceProvider.

class KasiaServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        $this->loadRoutesFrom(__DIR__ . '/routes.php');
        $this->loadViewsFrom(__DIR__ . '/views', 'ka');
        $this->loadMigrationsFrom(__DIR__ . '/migrations');
        $this->publishes([__DIR__ . '/config/con.php' => config_path('con.php')]);

    }

    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        ///$this->mergeConfigFrom(__DIR__ . '/config/con.php', 'kasia');
    }
}

When I'm trying to vendor publish I receive a message "Can't locate path:C:\xampp\datepicker\packages\ichau85\kasia/src/config/con.php" When I'm firing route defined in package's route file, error is dispplayed "Illuminate\Support\ServiceProvider::mergeConfigFrom(): Failed opening required 'C:\xampp\htdocs\datepicker\packages\michau85\kasia\src/config/con.php' (include_path='C:\xampp\php\PEAR')"

Structure of files looks like below. Other components (views, migrations, routes) works fine. I'm using Laravel 5.6. Please help.

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire