2018-01-26 14:35:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
2018-02-01 20:13:58 +00:00
|
|
|
use Artisan;
|
2018-02-04 21:28:11 +00:00
|
|
|
use App\Setting;
|
2018-01-26 14:35:01 +00:00
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2018-01-29 20:14:40 +00:00
|
|
|
if(!file_exists(database_path(env('DB_DATABASE')))) {
|
|
|
|
// first time setup
|
|
|
|
touch(database_path(env('DB_DATABASE')));
|
2018-02-04 20:50:59 +00:00
|
|
|
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true));
|
2018-02-02 15:16:55 +00:00
|
|
|
Artisan::call('storage:link');
|
2018-02-04 17:19:48 +00:00
|
|
|
//Cache
|
2018-02-04 17:45:01 +00:00
|
|
|
//Artisan::call('config:cache');
|
|
|
|
//Artisan::call('route:cache');
|
2018-01-29 20:14:40 +00:00
|
|
|
}
|
2018-02-04 21:28:11 +00:00
|
|
|
$alt_bg = '';
|
|
|
|
if($bg_image = Setting::fetch('background_image')) {
|
|
|
|
$alt_bg = ' style="background-image: url('.asset('storage/'.$bg_image).')"';
|
|
|
|
}
|
|
|
|
view()->share('alt_bg', $alt_bg);
|
|
|
|
|
2018-01-26 14:35:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2018-02-04 20:50:59 +00:00
|
|
|
$this->app->singleton('settings', function () {
|
|
|
|
return new Setting();
|
|
|
|
});
|
2018-01-26 14:35:01 +00:00
|
|
|
}
|
|
|
|
}
|