vendredi 13 septembre 2019

Is there a way to invoke a function (inside of a package) as soon as the package gets installed in the laravel app?

I'm currently developing a simple composer package for a laravel application. The package contains 5 php files and as soon as it gets installed these files should be copied in a new folder inside of the laravel app.

To do so I created a new command which should run the moveFiles function but I guess I didn't configure it correctly - when I try to run it I get - Command "move-files" is not defined. Please help!

ServiceProvider class:

class ThemeServiceProvider extends ServiceProvider {

protected $commands = ['mysteryreloaded\copytheme\Commands\MoveFiles'];

public function boot() {

}

public function register() {
    $this->commands($this->commands);
}
}

Command class:

class MoveFiles extends Command {
protected $signature = 'move-files';

public function handle() {
    $this->info(FilePacker::move());
}
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/30aTBFf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire