Laravel auto publish content

   
Just add the orange text below!!!

public function boot()
    {
        $this->package('foo/foo');
        //merge in database connections
        include __DIR__."/../../routes.php";

        // Auto-publish the assets when developing locally
        if (App::environment() == 'local' && !App::runningInConsole()) {
            $this->app->register('Illuminate\Foundation\Providers\PublisherServiceProvider');
            $workbench = realpath(base_path().'/workbench');
            if (strpos(__FILE__, $workbench) === false)
                App::make('asset.publisher')->publishPackage($this->package);
            else
                App::make('asset.publisher')->publishPackage($this->package, $workbench);
        }

    }


If it is not working, check your App::environment();
you could also add === 'dev' to the if statement.

$env = $app->detectEnvironment(array(
    'local' => array('*.local','local.*','localname'),
    'dev' => array('*.dev','dev.*'),
));

Popular Posts