Friday, January 31, 2014

Laravel auto publish content

Just add the orange text below!!!

public function boot()
        //merge in database connections
        include __DIR__."/../../routes.php";

        // Auto-publish the assets when developing locally
        if (App::environment() == 'local' && !App::runningInConsole()) {
            $workbench = realpath(base_path().'/workbench');
            if (strpos(__FILE__, $workbench) === false)
                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.*'),