Merge pull request #146 from openclassify/dia

Dia
This commit is contained in:
Fatih Alp 2019-11-13 19:23:04 +03:00 committed by GitHub
commit ee0381038c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 68 deletions

View File

@ -1,63 +1,16 @@
<?php namespace Visiosoft\AdvsModule; <?php namespace Visiosoft\AdvsModule;
use Anomaly\FilesModule\Disk\Contract\DiskRepositoryInterface;
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
use Anomaly\Streams\Platform\Database\Seeder\Seeder; use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel; use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
use Chumper\Zipper\Zipper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Visiosoft\AdvsModule\Seed\BlockSeeder; use Visiosoft\AdvsModule\Seed\BlockSeeder;
class AdvsModuleSeeder extends Seeder class AdvsModuleSeeder extends Seeder
{ {
/**
* The disk repository.
*
* @var DiskRepositoryInterface
*/
protected $disks;
/**
* The folder repository.
*
* @var FolderRepositoryInterface
*/
protected $folders;
/**
* Create a new FolderSeeder instance.
*
* @param DiskRepositoryInterface $disks
* @param FolderRepositoryInterface $folders
*/
public function __construct(DiskRepositoryInterface $disks, FolderRepositoryInterface $folders)
{
$this->disks = $disks;
$this->folders = $folders;
}
/** /**
* Run the seeder. * Run the seeder.
*/ */
public function run() public function run()
{ {
//Download demo SQL
$repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/";
file_put_contents(__DIR__."/demo.sql", fopen($repository."demo.sql", 'r'));
//Download demo Files and Extract to Files
file_put_contents("advs-files.zip", fopen($repository."advs-files.zip", 'r'));
$zipper = new Zipper();
$zipper->make('advs-files.zip')->folder('advs-files')->extractTo(base_path().'/public/app/default/files-module/local/images/');
$zipper->close();
$this->call(BlockSeeder::class); $this->call(BlockSeeder::class);
/* Demo Start */
DB::table('files_files')->truncate();
Model::unguard();
DB::unprepared(file_get_contents(__DIR__.'/demo.sql'));
Model::reguard();
/* Demo Stop*/
} }
} }

View File

@ -87,7 +87,7 @@ class AdvsController extends AdminController
if (strpos($entry->cover_photo, 'http') === 0) { if (strpos($entry->cover_photo, 'http') === 0) {
$wrapper = '<img width="64" src="'.$entry->cover_photo.'">'; $wrapper = '<img width="64" src="'.$entry->cover_photo.'">';
} else { } else {
$wrapper = '<img width="64" src="'.$request->root().$entry->cover_photo.'">'; $wrapper = '<img width="64" src="'.$request->root().'/'.$entry->cover_photo.'">';
} }
return $wrapper; return $wrapper;
}, },

View File

@ -1,9 +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\Support\Facades\DB;
use Visiosoft\CatsModule\Category\CategorySeeder;
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchSeeder; use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchSeeder;
class CatsModuleSeeder extends Seeder class CatsModuleSeeder extends Seeder
@ -13,22 +10,6 @@ class CatsModuleSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$this->call(CategorySeeder::class);
//Download demo SQL
$repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/";
file_put_contents(__DIR__."/categories.sql", fopen($repository."categories.sql", 'r'));
file_put_contents(__DIR__."/categoryTransEn.sql", fopen($repository."categoryTransEn.sql", 'r'));
//Download demo Files and Extract to Files
file_put_contents("category-files.zip", fopen($repository."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();
DB::unprepared(file_get_contents(__DIR__.'/categories.sql'));
DB::unprepared(file_get_contents(__DIR__.'/categoryTransEn.sql'));
Model::reguard();
} }
} }