TiktokShopProvider.php 1.0 KB
<?php

namespace Lackoxygen\TiktokShop;

use Illuminate\Support\ServiceProvider;
use Lackoxygen\TiktokShop\Command\RefreshToken;

class TiktokShopProvider extends ServiceProvider
{
    /**
     * @var string
     */
    public static string $name = 'tiktok.shop';

    protected array $commands = [
        RefreshToken::class
    ];

    /**
     * @return void
     */
    public function boot()
    {
        if ($this->app->runningInConsole()) {
            $configPath = __DIR__ . '/../publish/tiktok.shop.php';
            $this->publishes([
                $configPath => config_path('tiktok.shop.php')
            ], 'lackoxygen-tiktok-shop');
            $this->commands($this->commands);
        }
    }

    /**
     * @return void
     */
    public function register()
    {
        $this->app->singleton(static::$name, function () {
            return new TiktokShop();
        });
    }

    /**
     * @return string[]
     */
    public function provides(): array
    {
        return [static::$name];
    }
}