mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-12 16:26:07 -06:00
commit
b53a852a6a
@ -64,4 +64,9 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
|
||||
{
|
||||
$this->update(['icon' => $url]);
|
||||
}
|
||||
|
||||
public function getSubCategories()
|
||||
{
|
||||
return $this->where('parent_category_id', $this->getId())->get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,13 +146,13 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
||||
'c1.id',
|
||||
'c1.slug',
|
||||
'c1.parent_category_id',
|
||||
'c1.icon_id',
|
||||
'c1.icon',
|
||||
't1.name',
|
||||
'c2.id as c2_id',
|
||||
'c2.slug as c2_slug',
|
||||
'c2.icon as c2_icon',
|
||||
'c2.parent_category_id as c2_parent_category_id',
|
||||
't2.name as c2_name',
|
||||
'file.id as file_id'
|
||||
't2.name as c2_name'
|
||||
)
|
||||
->leftJoin($dBName . ' as c2', function ($join) {
|
||||
$join->on('c2.parent_category_id', '=', 'c1.id')
|
||||
@ -166,7 +166,6 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
||||
$join->on('c2.id', '=', 't2.entry_id')
|
||||
->where('t2.locale', Request()->session()->get('_locale', setting_value('streams::default_locale')));
|
||||
})
|
||||
->leftJoin('files_files as file', 'c1.icon_id', 'file.id')
|
||||
->whereNull('c1.deleted_at')
|
||||
->whereNull('c1.parent_category_id')
|
||||
->orderBy('c1.sort_order')
|
||||
|
||||
@ -13,4 +13,6 @@ interface CategoryInterface extends EntryInterface
|
||||
public function getMains($id);
|
||||
|
||||
public function setCategoryIconUrl($url);
|
||||
|
||||
public function getSubCategories();
|
||||
}
|
||||
|
||||
@ -6,17 +6,18 @@ use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||
use Anomaly\NavigationModule\Link\LinkModel;
|
||||
use Anomaly\NavigationModule\Menu\Contract\MenuRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
|
||||
use Anomaly\UrlLinkTypeExtension\UrlLinkTypeModel;
|
||||
use Anomaly\UsersModule\Role\Contract\RoleRepositoryInterface;
|
||||
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
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 WidgetSeeder;
|
||||
use ZipArchive;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@ -27,6 +28,7 @@ class DatabaseSeeder extends Seeder
|
||||
protected $activator;
|
||||
protected $disks;
|
||||
protected $folders;
|
||||
protected $command;
|
||||
|
||||
public function __construct(
|
||||
WidgetRepositoryInterface $widgets,
|
||||
@ -35,7 +37,8 @@ class DatabaseSeeder extends Seeder
|
||||
DiskRepositoryInterface $disks,
|
||||
FolderRepositoryInterface $folders,
|
||||
RoleRepositoryInterface $roles,
|
||||
UserActivator $activator
|
||||
UserActivator $activator,
|
||||
Command $command
|
||||
)
|
||||
{
|
||||
$this->widgets = $widgets;
|
||||
@ -45,6 +48,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->activator = $activator;
|
||||
$this->disks = $disks;
|
||||
$this->folders = $folders;
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
public function run()
|
||||
@ -113,7 +117,7 @@ class DatabaseSeeder extends Seeder
|
||||
]
|
||||
);
|
||||
|
||||
$repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/upgrade3.8/";
|
||||
$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'));
|
||||
@ -127,14 +131,17 @@ class DatabaseSeeder extends Seeder
|
||||
Model::reguard();
|
||||
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip = new \ZipArchive();
|
||||
$zip->open(storage_path('images.zip'), ZipArchive::CREATE);
|
||||
$zip->extractTo(storage_path('streams/default/files-module/local/images/'));
|
||||
$zip->open(storage_path('cats.zip'), ZipArchive::CREATE);
|
||||
$zip->extractTo(storage_path('streams/default/files-module/local/images/'));
|
||||
$zip->extractTo(storage_path('streams/default/files-module/local/category_icon/'));
|
||||
$zip->close();
|
||||
|
||||
$this->call(widgetSeeder::class);
|
||||
//Sync Files
|
||||
$this->command->call('files:sync');
|
||||
|
||||
$this->call(WidgetSeeder::class);
|
||||
|
||||
|
||||
//Create Store Icon Folder
|
||||
@ -210,6 +217,12 @@ class DatabaseSeeder extends Seeder
|
||||
]);
|
||||
};
|
||||
|
||||
//Demodata Seeder
|
||||
if(is_module_installed('visiosoft.module.demodata'))
|
||||
{
|
||||
$this->call(\Visiosoft\DemodataModule\Demodata\DemodataSeeder::class);
|
||||
}
|
||||
|
||||
Artisan::call('assets:clear');
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ use Anomaly\DashboardModule\Dashboard\Contract\DashboardRepositoryInterface;
|
||||
use Anomaly\DashboardModule\Widget\Contract\WidgetRepositoryInterface;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class widgetSeeder extends Seeder
|
||||
class WidgetSeeder extends Seeder
|
||||
{
|
||||
protected $widgets;
|
||||
protected $dashboards;
|
||||
Loading…
Reference in New Issue
Block a user