Import Demo Categories From Remote Source

This commit is contained in:
vedatakd 2019-06-24 18:19:00 +03:00
parent 6de876353d
commit 0ca1b71cef
3 changed files with 13 additions and 94133 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\CatsModule; <?php namespace Visiosoft\CatsModule;
use Anomaly\Streams\Platform\Database\Seeder\Seeder; use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Chumper\Zipper\Zipper;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Visiosoft\CatsModule\Category\CategorySeeder; use Visiosoft\CatsModule\Category\CategorySeeder;
@ -13,10 +14,20 @@ class CatsModuleSeeder extends Seeder
public function run() public function run()
{ {
$this->call(CategorySeeder::class); $this->call(CategorySeeder::class);
//Download demo SQL
file_put_contents(__DIR__."/categories.sql", fopen("http://ilandemo.vebze.com/categories.sql", 'r'));
file_put_contents(__DIR__."/categoryTransEn.sql", fopen("http://ilandemo.vebze.com/categoryTransEn.sql", 'r'));
//Download demo Files and Extract to Files
file_put_contents("category-files.zip", fopen("http://ilandemo.vebze.com/category-files.zip", 'r'));
$zipper = new Zipper();
$zipper->make('category-files.zip')->folder('category-files')->extractTo(base_path().'/public/app/default/files-module/local/images/');
$zipper->close();
$this->call(PlaceholderforsearchSeeder::class); $this->call(PlaceholderforsearchSeeder::class);
Model::unguard(); Model::unguard();
DB::unprepared(file_get_contents(__DIR__.'/Category/categories.sql')); DB::unprepared(file_get_contents(__DIR__.'/categories.sql'));
DB::unprepared(file_get_contents(__DIR__.'/Category/categoryTransEn.sql')); DB::unprepared(file_get_contents(__DIR__.'/categoryTransEn.sql'));
Model::reguard(); Model::reguard();
} }
} }