From ab83c3a5513e89a8a52565aaa404025e00715679 Mon Sep 17 00:00:00 2001 From: Kode Date: Fri, 9 Nov 2018 23:07:01 +0000 Subject: [PATCH] Small changes Copy icon if missing on new app add. Change order of create symlink and load apps --- app/Application.php | 8 ++++++++ app/Providers/AppServiceProvider.php | 10 +++++----- app/SupportedApps.php | 4 ++-- public/mix-manifest.json | 6 +++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/Application.php b/app/Application.php index 7b01b07d..de1c70b5 100644 --- a/app/Application.php +++ b/app/Application.php @@ -13,6 +13,14 @@ class Application extends Model // public function icon() { + if(!file_exists(storage_path('app/public/'.$this->icon))) { + $img_src = app_path('SupportedApps/'.$this->name.'/'.str_replace('icons/', '', $this->icon)); + $img_dest = storage_path('app/public/'.$this->icon); + //die("i: ".$img_src); + @copy($img_src, $img_dest); + } + + return $this->icon; } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 832ab2b5..28ad5c27 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -47,6 +47,11 @@ class AppServiceProvider extends ServiceProvider } } + + if(!is_file(public_path('storage'))) { + Artisan::call('storage:link'); + \Session::put('current_user', null); + } $applications = Application::all(); if($applications->count() <= 0) { @@ -58,11 +63,6 @@ class AppServiceProvider extends ServiceProvider } - if(!is_file(public_path('storage'))) { - Artisan::call('storage:link'); - \Session::put('current_user', null); - } - // User specific settings need to go here as session isn't available at this point in the app view()->composer('*', function ($view) { diff --git a/app/SupportedApps.php b/app/SupportedApps.php index a8d19770..63ecdb79 100644 --- a/app/SupportedApps.php +++ b/app/SupportedApps.php @@ -143,8 +143,8 @@ abstract class SupportedApps public static function saveApp($details, $app) { - if(!file_exists(public_path('storage/icons'))) { - mkdir(public_path('storage/icons'), 0777, true); + if(!file_exists(storage_path('app/public/icons'))) { + mkdir(storage_path('app/public/icons'), 0777, true); } $img_src = app_path('SupportedApps/'.className($details->name).'/'.$details->icon); diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 8d586304..5175a6b0 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=476a34b0b53427a036fd", - "/js/app.js": "/js/app.js?id=8dc4a6ea723d0df7469d" -} \ No newline at end of file + "/js/app.js": "/js/app.js?id=8dc4a6ea723d0df7469d", + "/css/app.css": "/css/app.css?id=476a34b0b53427a036fd" +}