#144 remove the seeder/data from project

This commit is contained in:
Diatrex 2019-11-13 17:29:46 +03:00
parent 63d1e5601a
commit 6e9edf499d
3 changed files with 2 additions and 68 deletions

View File

@ -1,63 +1,16 @@
<?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\Model\Options\OptionsAdvertisementEntryModel;
use Chumper\Zipper\Zipper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Visiosoft\AdvsModule\Seed\BlockSeeder;
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.
*/
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);
/* 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) {
$wrapper = '<img width="64" src="'.$entry->cover_photo.'">';
} else {
$wrapper = '<img width="64" src="'.$request->root().$entry->cover_photo.'">';
$wrapper = '<img width="64" src="'.$request->root().'/'.$entry->cover_photo.'">';
}
return $wrapper;
},

View File

@ -1,9 +1,6 @@
<?php namespace Visiosoft\CatsModule;
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;
class CatsModuleSeeder extends Seeder
@ -13,22 +10,6 @@ class CatsModuleSeeder extends Seeder
*/
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);
Model::unguard();
DB::unprepared(file_get_contents(__DIR__.'/categories.sql'));
DB::unprepared(file_get_contents(__DIR__.'/categoryTransEn.sql'));
Model::reguard();
}
}