samedi 31 décembre 2016

Laravel's php artisan vendor:publish is not publishing

I have a project written on the top of Laravel 5.3. I am trying to execute php artisan vendor:publish for a specific vendor. But the command keep giving me this useless message Nothing to publish for tag [].

I don't understand why this command does not give you better info.

Here is the exact command

php artisan vendor:publish --provider="CrestApps\\CodeGenerator\\CodeGeneratorServiceProvider"

I actually went into CrestApps\CodeGenerator\CodeGeneratorServiceProvider and var dumped a message in the boot() method and I got that message. So the correct service provider is being called.

This is the code from my service provider

<?php

namespace CrestApps\CodeGenerator;

use Illuminate\Support\ServiceProvider;

class CodeGeneratorServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {

        $this->publishes([
            __DIR__ . '\\..\\config\\codegenerator.php' => config_path('codegenerator.php'),
        ]);

        $this->publishes([
            __DIR__ . '\\templates' => base_path('resources\\codegenerator-templates\\default'),
        ]);

    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->commands(
            'CrestApps\CodeGenerator\Commands\CreateControllerCommand',
            'CrestApps\CodeGenerator\Commands\CreateModelCommand',
            'CrestApps\CodeGenerator\Commands\CreateIndexViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateCreateViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateFormViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateEditViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateShowViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateViewsCommand',
            'CrestApps\CodeGenerator\Commands\CreateLanguageCommand',
            'CrestApps\CodeGenerator\Commands\CreateFormRequestCommand',
            'CrestApps\CodeGenerator\Commands\CreateRoutesCommand',
            'CrestApps\CodeGenerator\Commands\CreateMigrationCommand',
            'CrestApps\CodeGenerator\Commands\CreateResourceCommand',
            'CrestApps\CodeGenerator\Commands\CreateViewLayoutCommand'
        );
    }
}

I validated that the file/folder that are being copied are correct and exists using scandir() and get_file_content()

What could be causing this problem? why no files are being copied to the destination?

There is nothing in the Laravel's log file to also help me here.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire