edbizarro/clash-royale-api

View on GitHub
src/ClashRoyaleServiceProvider.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Edbizarro\ClashRoyale;

use Illuminate\Support\ServiceProvider;

class ClashRoyaleServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot()
    {
        $this->registerPublishing();
    }

    /**
     * Register the application services.
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/clash-royale.php',
            'clash-royale'
        );

        Api::setApiToken(config('clash-royale.token'));
    }

    protected function registerPublishing(): void
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__.'/../config/clash-royale.php' => config_path('clash-royale.php'),
            ], 'clash-royale');
        }
    }
}