<?php

namespace Busayo\Mention;

use Busayo\Mention\Factory\MentionBuilder;
use Illuminate\Support\ServiceProvider;

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


    public function boot()
    {
        $this->setup(__DIR__)
             ->publishConfig()
             ->publishViews()
             ->publishAssets()
             ->loadViews()
             ->loadRoutes()
             ->mergeConfig('mentions');
    }


    /**
     * Register the application services
     * @return void
     */
    public function register()
    {
         $this->app->singleton('mentionBuilder', function ($app) {
            $form = new MentionBuilder($app['html'], $app['url'], $app['session.store']->getToken());

            return $form->setSessionStore($app['session.store']);
        });
    }

}

<?php

namespace Busayo\Mention;

use Busayo\Mention\Factory\MentionBuilder;
use Illuminate\Support\ServiceProvider;

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


    public function boot()
    {
        $config = realpath(__DIR__.'/../resources/config/mentions.php');
        $views  = realpath(__DIR__.'/../resources/views');
        $script = realpath(__DIR__.'/../resources/assets');

        $this->publishes([
            $config => config_path('mentions.php'),
            $views  => base_path('resources/views/vendor/mentions'),
            $script => public_path('js'),
        ]);

        $this->loadViewsFrom(__DIR__.'/../resources/views', 'mentions');

         if (! $this->app->routesAreCached()) {
            require __DIR__.'/../Http/routes.php';
        }
    }


    /**
     * Register the application services
     * @return void
     */
    public function register()
    {
         $this->app->singleton('mentionBuilder', function ($app) {
            $form = new MentionBuilder($app['html'], $app['url'], $app['session.store']->getToken());

            return $form->setSessionStore($app['session.store']);
        });
    }

}

Add publishing feature to ServiceProvider
Add publishing feature to ServiceProvider
