mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 23:36:08 -06:00
Database seeder
This commit is contained in:
parent
7f37a2bb87
commit
a1809f61c3
@ -14,10 +14,6 @@ use Anomaly\UsersModule\User\UserActivator;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Anomaly\DashboardModule\Widget\Contract\WidgetRepositoryInterface;
|
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;
|
use Visiosoft\AdvsModule\Adv\Command\DeleteInstaller;
|
||||||
use WidgetSeeder;
|
use WidgetSeeder;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
@ -133,42 +129,11 @@ class DatabaseSeeder extends Seeder
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$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')));
|
|
||||||
|
|
||||||
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);
|
$this->call(WidgetSeeder::class);
|
||||||
|
|
||||||
//Delete Installer
|
//Delete Installer
|
||||||
dispatch_now(new DeleteInstaller());
|
dispatch_now(new DeleteInstaller());
|
||||||
|
|
||||||
|
|
||||||
if (is_null($this->folders->findBy('slug', 'ads_excel'))) {
|
if (is_null($this->folders->findBy('slug', 'ads_excel'))) {
|
||||||
$disk = $this->disks->findBySlug('local');
|
$disk = $this->disks->findBySlug('local');
|
||||||
|
|
||||||
@ -248,7 +213,5 @@ class DatabaseSeeder extends Seeder
|
|||||||
if (is_module_installed('visiosoft.module.demodata')) {
|
if (is_module_installed('visiosoft.module.demodata')) {
|
||||||
$this->call(\Visiosoft\DemodataModule\Demodata\DemodataSeeder::class);
|
$this->call(\Visiosoft\DemodataModule\Demodata\DemodataSeeder::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
Artisan::call('assets:clear');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Model\Advs\AdvsCategoriesEntryModel;
|
|
||||||
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
|
|
||||||
use Anomaly\Streams\Platform\Model\Options\OptionsContactSettingsEntryModel;
|
|
||||||
use Anomaly\Streams\Platform\Model\Options\OptionsGeneralSettingsEntryModel;
|
|
||||||
use Anomaly\Streams\Platform\Model\Options\OptionsThemeSettingsEntryModel;
|
|
||||||
use Anomaly\Streams\Platform\Model\Search\SearchCategoriesEntryModel;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Visiosoft\AdvsModule\City\CitySeeder;
|
|
||||||
use Visiosoft\AdvsModule\Country\CountrySeeder;
|
|
||||||
use Visiosoft\AdvsModule\District\DistrictSeeder;
|
|
||||||
use Visiosoft\AdvsModule\Neighborhood\NeighborhoodSeeder;
|
|
||||||
use Visiosoft\AdvsModule\Village\VillageSeeder;
|
|
||||||
|
|
||||||
class GridSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
//run
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user