diff --git a/composer.json b/composer.json index c5f67af15..63dafa4f9 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "barryvdh/laravel-dompdf": "0.8.*", "doctrine/dbal": "~2.3", "maatwebsite/excel": "^3.1", - "intervention/imagecache":"^2.3" + "intervention/imagecache":"^2.3", + "laravel/framework": "^6.18|^7.28|^8.34" }, "autoload": { "psr-4": { diff --git a/src/CRUDBoosterServiceProvider.php b/src/CRUDBoosterServiceProvider.php index 8004b8701..e3b007443 100644 --- a/src/CRUDBoosterServiceProvider.php +++ b/src/CRUDBoosterServiceProvider.php @@ -50,10 +50,12 @@ public function register() $this->registerSingleton(); - $this->commands('crudboosterinstall'); - $this->commands('crudboosterupdate'); - $this->commands('crudboosterVersionCommand'); - $this->commands('crudboosterMailQueue'); + if($this->app->runningInConsole()) { + $this->commands('crudboosterinstall'); + $this->commands('crudboosterupdate'); + $this->commands('crudboosterVersionCommand'); + $this->commands('crudboosterMailQueue'); + } $loader = AliasLoader::getInstance(); $loader->alias('PDF', 'Barryvdh\DomPDF\Facade'); diff --git a/src/commands/CrudboosterInstallationCommand.php b/src/commands/CrudboosterInstallationCommand.php index 2e4269d6a..9422776d8 100644 --- a/src/commands/CrudboosterInstallationCommand.php +++ b/src/commands/CrudboosterInstallationCommand.php @@ -57,11 +57,12 @@ public function handle() $process->setWorkingDirectory(base_path())->run(); $this->info('Migrating database...'); - $this->call('migrate'); if (! class_exists('CBSeeder')) { require_once __DIR__.'/../database/seeds/CBSeeder.php'; } + + $this->call('migrate'); $this->call('db:seed', ['--class' => 'CBSeeder']); $this->call('config:clear'); if (app()->version() < 5.6) { diff --git a/src/commands/CrudboosterVersionCommand.php b/src/commands/CrudboosterVersionCommand.php index 645a2d640..d35c286e8 100644 --- a/src/commands/CrudboosterVersionCommand.php +++ b/src/commands/CrudboosterVersionCommand.php @@ -25,7 +25,7 @@ class CrudboosterVersionCommand extends Command * @return mixed */ - public static $version = "5.5.0"; + public static $version = "5.5.7"; public function handle() { diff --git a/src/database/seeds/CBSeeder.php b/src/database/seeds/CBSeeder.php index da30492be..761c16856 100644 --- a/src/database/seeds/CBSeeder.php +++ b/src/database/seeds/CBSeeder.php @@ -1,6 +1,9 @@ command->info('Please wait updating the data...'); + # User + if (DB::table('cms_users')->count() == 0) { + $password = Hash::make('123456'); + $cms_users = DB::table('cms_users')->insert([ + 'created_at' => date('Y-m-d H:i:s'), + 'name' => 'Super Admin', + 'email' => 'admin@crudbooster.com', + 'password' => $password, + 'id_cms_privileges' => 1, + 'status' => 'Active', + ]); + } + $this->command->info("Create users completed"); + # User End - $this->call('Cms_usersSeeder'); - $this->call('Cms_modulsSeeder'); - $this->call('Cms_privilegesSeeder'); - $this->call('Cms_privileges_rolesSeeder'); - $this->call('Cms_settingsSeeder'); - $this->call('CmsEmailTemplates'); + # Email Templates + DB::table('cms_email_templates')->insert([ + 'created_at' => date('Y-m-d H:i:s'), + 'name' => 'Email Template Forgot Password Backend', + 'slug' => 'forgot_password_backend', + 'content' => '

Hi,

Someone requested forgot password, here is your new password : 

[password]


--

Regards,

Admin

', + 'description' => '[password]', + 'from_name' => 'System', + 'from_email' => 'system@crudbooster.com', + 'cc_email' => null, + ]); + $this->command->info("Create email templates completed"); + + # CB Modules + $data = [ + [ - $this->command->info('Updating the data completed !'); - } -} + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Notifications'), + 'icon' => 'fa fa-cog', + 'path' => 'notifications', + 'table_name' => 'cms_notifications', + 'controller' => 'NotificationsController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ -class CmsEmailTemplates extends Seeder -{ - public function run() - { - DB::table('cms_email_templates')->insert([ 'created_at' => date('Y-m-d H:i:s'), - 'name' => 'Email Template Forgot Password Backend', - 'slug' => 'forgot_password_backend', - 'content' => '

Hi,

Someone requested forgot password, here is your new password : 

[password]


--

Regards,

Admin

', - 'description' => '[password]', - 'from_name' => 'System', - 'from_email' => 'system@crudbooster.com', - 'cc_email' => null, - ]); - } -} + 'name' => cbLang('Privileges'), + 'icon' => 'fa fa-cog', + 'path' => 'privileges', + 'table_name' => 'cms_privileges', + 'controller' => 'PrivilegesController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ -class Cms_settingsSeeder extends Seeder -{ - public function run() - { + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Privileges_Roles'), + 'icon' => 'fa fa-cog', + 'path' => 'privileges_roles', + 'table_name' => 'cms_privileges_roles', + 'controller' => 'PrivilegesRolesController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Users_Management'), + 'icon' => 'fa fa-users', + 'path' => 'users', + 'table_name' => 'cms_users', + 'controller' => 'AdminCmsUsersController', + 'is_protected' => 0, + 'is_active' => 1, + ], + [ + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('settings'), + 'icon' => 'fa fa-cog', + 'path' => 'settings', + 'table_name' => 'cms_settings', + 'controller' => 'SettingsController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Module_Generator'), + 'icon' => 'fa fa-database', + 'path' => 'module_generator', + 'table_name' => 'cms_moduls', + 'controller' => 'ModulsController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Menu_Management'), + 'icon' => 'fa fa-bars', + 'path' => 'menu_management', + 'table_name' => 'cms_menus', + 'controller' => 'MenusController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Email_Templates'), + 'icon' => 'fa fa-envelope-o', + 'path' => 'email_templates', + 'table_name' => 'cms_email_templates', + 'controller' => 'EmailTemplatesController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Statistic_Builder'), + 'icon' => 'fa fa-dashboard', + 'path' => 'statistic_builder', + 'table_name' => 'cms_statistics', + 'controller' => 'StatisticBuilderController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('API_Generator'), + 'icon' => 'fa fa-cloud-download', + 'path' => 'api_generator', + 'table_name' => '', + 'controller' => 'ApiCustomController', + 'is_protected' => 1, + 'is_active' => 1, + ], + [ + + 'created_at' => date('Y-m-d H:i:s'), + 'name' => cbLang('Log_User_Access'), + 'icon' => 'fa fa-flag-o', + 'path' => 'logs', + 'table_name' => 'cms_logs', + 'controller' => 'LogsController', + 'is_protected' => 1, + 'is_active' => 1, + ], + ]; + + foreach ($data as $k => $d) { + if (DB::table('cms_moduls')->where('name', $d['name'])->count()) { + unset($data[$k]); + } + } + + DB::table('cms_moduls')->insert($data); + $this->command->info("Create default cb modules completed"); + # CB Modules End + + + # CB Setting $data = [ //LOGIN REGISTER STYLE @@ -226,14 +360,18 @@ public function run() } DB::table('cms_settings')->insert($row); } - } -} - -class Cms_privileges_rolesSeeder extends Seeder -{ - public function run() - { + $this->command->info("Create cb settings completed"); + # CB Setting End + # CB Privilege + if (DB::table('cms_privileges')->where('name', 'Super Administrator')->count() == 0) { + DB::table('cms_privileges')->insert([ + 'created_at' => date('Y-m-d H:i:s'), + 'name' => 'Super Administrator', + 'is_superadmin' => 1, + 'theme_color' => 'skin-red', + ]); + } if (DB::table('cms_privileges_roles')->count() == 0) { $modules = DB::table('cms_moduls')->get(); $i = 1; @@ -274,185 +412,9 @@ public function run() $i++; } } - } -} - -class Cms_privilegesSeeder extends Seeder -{ - public function run() - { - - if (DB::table('cms_privileges')->where('name', 'Super Administrator')->count() == 0) { - DB::table('cms_privileges')->insert([ - 'created_at' => date('Y-m-d H:i:s'), - 'name' => 'Super Administrator', - 'is_superadmin' => 1, - 'theme_color' => 'skin-red', - ]); - } - } -} - -class Cms_modulsSeeder extends Seeder -{ - public function run() - { - - /* - 1 = Public - 2 = Setting - */ - - $data = [ - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Notifications'), - 'icon' => 'fa fa-cog', - 'path' => 'notifications', - 'table_name' => 'cms_notifications', - 'controller' => 'NotificationsController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Privileges'), - 'icon' => 'fa fa-cog', - 'path' => 'privileges', - 'table_name' => 'cms_privileges', - 'controller' => 'PrivilegesController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Privileges_Roles'), - 'icon' => 'fa fa-cog', - 'path' => 'privileges_roles', - 'table_name' => 'cms_privileges_roles', - 'controller' => 'PrivilegesRolesController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Users_Management'), - 'icon' => 'fa fa-users', - 'path' => 'users', - 'table_name' => 'cms_users', - 'controller' => 'AdminCmsUsersController', - 'is_protected' => 0, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('settings'), - 'icon' => 'fa fa-cog', - 'path' => 'settings', - 'table_name' => 'cms_settings', - 'controller' => 'SettingsController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Module_Generator'), - 'icon' => 'fa fa-database', - 'path' => 'module_generator', - 'table_name' => 'cms_moduls', - 'controller' => 'ModulsController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Menu_Management'), - 'icon' => 'fa fa-bars', - 'path' => 'menu_management', - 'table_name' => 'cms_menus', - 'controller' => 'MenusController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Email_Templates'), - 'icon' => 'fa fa-envelope-o', - 'path' => 'email_templates', - 'table_name' => 'cms_email_templates', - 'controller' => 'EmailTemplatesController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Statistic_Builder'), - 'icon' => 'fa fa-dashboard', - 'path' => 'statistic_builder', - 'table_name' => 'cms_statistics', - 'controller' => 'StatisticBuilderController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('API_Generator'), - 'icon' => 'fa fa-cloud-download', - 'path' => 'api_generator', - 'table_name' => '', - 'controller' => 'ApiCustomController', - 'is_protected' => 1, - 'is_active' => 1, - ], - [ - - 'created_at' => date('Y-m-d H:i:s'), - 'name' => cbLang('Log_User_Access'), - 'icon' => 'fa fa-flag-o', - 'path' => 'logs', - 'table_name' => 'cms_logs', - 'controller' => 'LogsController', - 'is_protected' => 1, - 'is_active' => 1, - ], - ]; - - foreach ($data as $k => $d) { - if (DB::table('cms_moduls')->where('name', $d['name'])->count()) { - unset($data[$k]); - } - } - - DB::table('cms_moduls')->insert($data); - } -} + $this->command->info("Create roles completed"); + # CB Privilege End -class Cms_usersSeeder extends Seeder -{ - public function run() - { - - if (DB::table('cms_users')->count() == 0) { - $password = \Hash::make('123456'); - $cms_users = DB::table('cms_users')->insert([ - 'created_at' => date('Y-m-d H:i:s'), - 'name' => 'Super Admin', - 'email' => 'admin@crudbooster.com', - 'password' => $password, - 'id_cms_privileges' => 1, - 'status' => 'Active', - ]); - } + $this->command->info('All cb seeders completed !'); } -} - +} \ No newline at end of file diff --git a/src/views/default/table.blade.php b/src/views/default/table.blade.php index e761bf594..6c12c4ab7 100644 --- a/src/views/default/table.blade.php +++ b/src/views/default/table.blade.php @@ -368,7 +368,7 @@ class="filter-combo form-control"> @@ -34,15 +34,15 @@ @foreach($result as $row) @foreach($columns as $col) - $col, PATHINFO_EXTENSION); + $ext = isset($row)&&isset($col) ? pathinfo($row->$col, PATHINFO_EXTENSION) : null; if ($ext && in_array($ext, $img_extension)) { echo ""; } else { echo "".str_limit(strip_tags($row->$col), 50).""; } - ?> + @endphp @endforeach