X

Create New Item

File Folder

X

Search Results

File "PublishesResources.php"

Full path: /home/orbitecv/orbite-school.orbit.et/vendor/spatie/laravel-package-tools/src/Commands/Concerns/PublishesResources.php
File size: 1.05 KiB (1076 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Edit   Back

<?php

namespace Spatie\LaravelPackageTools\Commands\Concerns;

trait PublishesResources
{
    protected array $publishes = [];

    public function publish(string ...$tag): self
    {
        $this->publishes = array_merge($this->publishes, $tag);

        return $this;
    }

    public function publishAssets(): self
    {
        return $this->publish('assets');
    }

    public function publishConfigFile(): self
    {
        return $this->publish('config');
    }

    public function publishInertiaComponents(): self
    {
        return $this->publish('inertia-components');
    }

    public function publishMigrations(): self
    {
        return $this->publish('migrations');
    }

    protected function processPublishes(): self
    {
        foreach ($this->publishes as $tag) {
            $name = str_replace('-', ' ', $tag);
            $this->comment("Publishing {$name}...");

            $this->callSilently("vendor:publish", [
                '--tag' => "{$this->package->shortName()}-{$tag}",
            ]);
        }

        return $this;
    }
}