mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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\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;
|
||||
use WidgetSeeder;
|
||||
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);
|
||||
|
||||
//Delete Installer
|
||||
dispatch_now(new DeleteInstaller());
|
||||
|
||||
|
||||
if (is_null($this->folders->findBy('slug', 'ads_excel'))) {
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
@ -248,7 +213,5 @@ class DatabaseSeeder extends Seeder
|
||||
if (is_module_installed('visiosoft.module.demodata')) {
|
||||
$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