diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index aa31095e1..b1a949dda 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -4,18 +4,14 @@ namespace Database\Seeders; use Anomaly\FilesModule\Disk\Contract\DiskRepositoryInterface; use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface; -use Anomaly\NavigationModule\Link\LinkModel; use Anomaly\NavigationModule\Menu\Contract\MenuRepositoryInterface; -use Anomaly\Streams\Platform\Entry\EntryRepository; -use Anomaly\UrlLinkTypeExtension\UrlLinkTypeModel; use Anomaly\UsersModule\Role\Contract\RoleRepositoryInterface; use Anomaly\UsersModule\User\Contract\UserRepositoryInterface; use Anomaly\UsersModule\User\UserActivator; use Illuminate\Console\Command; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Seeder; use Anomaly\DashboardModule\Widget\Contract\WidgetRepositoryInterface; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\DB; use Symfony\Component\Console\Input\ArgvInput; use Visiosoft\AdvsModule\Adv\Command\DeleteInstaller; @@ -57,7 +53,6 @@ class DatabaseSeeder extends Seeder public function run() { - $admin = $this->roles->findBySlug('admin'); $this->users->unguard(); @@ -90,85 +85,18 @@ class DatabaseSeeder extends Seeder 'slug' => 'category_icon', 'disk' => $disk, ]); - }; - - //Footer Link - LinkModel::query()->forceDelete(); - $repository = new EntryRepository(); - $repository->setModel(new UrlLinkTypeModel()); - $menu = $this->menus->findBySlug('footer'); - - - $openclassify = $repository->create( - [ - 'en' => [ - 'title' => 'OpenClassify.com', - ], - 'url' => 'https://openclassify.com/', - ] - ); - $visiosoft = $repository->create( - [ - 'en' => [ - 'title' => 'Visiosoft Inc.', - ], - 'url' => 'https://visiosoft.com.tr/', - ] - ); - - LinkModel::query()->create( - [ - 'menu' => $menu, - 'target' => '_blank', - 'entry' => $openclassify, - 'type' => 'anomaly.extension.url_link_type', - ] - ); - LinkModel::query()->create( - [ - 'menu' => $menu, - 'target' => '_blank', - 'entry' => $visiosoft, - 'type' => 'anomaly.extension.url_link_type', - ] - ); - - $repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/"; - file_put_contents(storage_path('advs.sql'), fopen($repository . "advs.sql", 'r')); - file_put_contents(storage_path('settings.sql'), fopen($repository . "settings.sql", 'r')); - file_put_contents(storage_path('categories.sql'), fopen($repository . "categories.sql", 'r')); - file_put_contents(storage_path('images.zip'), fopen($repository . "images.zip", "r")); - file_put_contents(storage_path('cats.zip'), fopen($repository . "cats.zip", "r")); - + } $application_reference = (new ArgvInput())->getParameterOption('--app', env('APPLICATION_REFERENCE', 'default')); - - $categories = str_replace('{application_reference}', $application_reference, file_get_contents(storage_path('categories.sql'))); - $advs = str_replace('{application_reference}', $application_reference, file_get_contents(storage_path('advs.sql'))); - $settings = str_replace('{application_reference}', $application_reference, file_get_contents(storage_path('settings.sql'))); - + $settings = str_replace('{application_reference}', $application_reference, + file_get_contents(realpath(dirname(__DIR__)) . '/seeders/settings.sql')); Model::unguard(); - DB::unprepared($advs); - DB::unprepared($categories); DB::unprepared($settings); Model::reguard(); - - - $zip = new \ZipArchive(); - $zip->open(storage_path('images.zip'), ZipArchive::CREATE); - $zip->extractTo(storage_path('streams/' . $application_reference . '/files-module/local/images/')); - $zip->open(storage_path('cats.zip'), ZipArchive::CREATE); - $zip->extractTo(storage_path('streams/' . $application_reference . '/files-module/local/category_icon/')); - $zip->close(); - - //Sync Files - $this->command->call('files:sync'); - $this->call(WidgetSeeder::class); //Delete Installer dispatch_now(new DeleteInstaller()); - if (is_null($this->folders->findBy('slug', 'ads_excel'))) { $disk = $this->disks->findBySlug('local'); @@ -180,7 +108,7 @@ class DatabaseSeeder extends Seeder 'slug' => 'ads_excel', 'disk' => $disk, ]); - }; + } if ($images_folder = $this->folders->findBySlug('images')) { @@ -207,7 +135,7 @@ class DatabaseSeeder extends Seeder 'ico', 'png', ], ]); - }; + } //Banner Image Folder if (is_null($this->folders->findBy('slug', 'banner_images'))) { @@ -242,13 +170,11 @@ class DatabaseSeeder extends Seeder 'pdf', 'doc', 'docx', 'xls', 'xlsx', ], ]); - }; + } //Demodata Seeder if (is_module_installed('visiosoft.module.demodata')) { $this->call(\Visiosoft\DemodataModule\Demodata\DemodataSeeder::class); } - - Artisan::call('assets:clear'); } } diff --git a/database/seeders/GridSeeder.php b/database/seeders/GridSeeder.php deleted file mode 100644 index a2da5cb97..000000000 --- a/database/seeders/GridSeeder.php +++ /dev/null @@ -1,28 +0,0 @@ -\"Home

'), +('2020-09-25 11:12:33', 1, '2020-10-01 15:11:10', 1, 'visiosoft.theme.sahibinden::home_bottom_left_categories', '

'), +('2020-09-25 11:12:33', 1, '2020-10-01 15:11:10', 1, 'visiosoft.theme.sahibinden::home_top_latestAds', '

'), +('2020-09-25 11:12:33', 1, '2020-10-01 15:11:10', 1, 'visiosoft.theme.sahibinden::home_bottom_latestAds', '

\"Home

'), +('2020-11-12 06:58:45', 1, '2020-11-16 14:25:22', 1, 'streams::mail_driver', 'log') +ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `sort_order` = VALUES(`sort_order`), `created_at` = VALUES(`created_at`), `created_by_id` = VALUES(`created_by_id`), `updated_at` = VALUES(`updated_at`), `updated_by_id` = VALUES(`updated_by_id`), `key` = VALUES(`key`), `value` = VALUES(`value`); -INSERT INTO `default_settings_settings` (`created_at`,`key`, `value`) VALUES -('2019-07-15 06:48:46', 'streams::date_format', 'j F, Y'), -('2019-07-15 06:48:46', 'streams::time_format', 'H:i'), -('2019-07-15 06:48:46', 'streams::name', 'PHP Classifieds software'), -('2019-07-15 06:48:46', 'streams::description', 'OpenClassify is modular and most advanced open source classified platform build with Laravel.Use it in real estate classifieds, auto, e-commerce and other ...'), -('2019-07-15 06:48:46', 'streams::standard_theme', 'visiosoft.theme.base'), -('2019-07-15 06:48:46', 'streams::admin_theme', 'visiosoft.theme.defaultadmin'), -('2019-07-15 06:48:46', 'streams::enabled_locales', 'a:11:{i:0;s:2:\"en\";i:1;s:2:\"fa\";i:2;s:2:\"ar\";i:3;s:2:\"el\";i:4;s:2:\"es\";i:5;s:2:\"fr\";i:6;s:2:\"it\";i:7;s:2:\"nl\";i:8;s:2:\"pt\";i:9;s:2:\"ru\";i:10;s:2:\"tr\";}'); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file