diff --git a/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig b/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig
index afa8736a4..223babf0f 100644
--- a/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig
+++ b/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig
@@ -1,15 +1,20 @@
+{% set folders = entries('files','folders').whereIn('slug',field_type.configGet('folders')).get() %}
+{% set allowed_types = {} %}
+{% for mimes in folders.pluck('allowed_types.value').all() %}
+ {% set allowed_types = allowed_types|merge(mimes) %}
+{% endfor %}
\ No newline at end of file
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index b8ae3bc0a..b90ff0f09 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -18,135 +18,143 @@ use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder
{
- protected $widgets;
- protected $menus;
- protected $users;
- protected $roles;
- protected $activator;
- protected $disks;
- protected $folders;
+ protected $widgets;
+ protected $menus;
+ protected $users;
+ protected $roles;
+ protected $activator;
+ protected $disks;
+ protected $folders;
- public function __construct(
- WidgetRepositoryInterface $widgets,
- MenuRepositoryInterface $menus,
- UserRepositoryInterface $users,
- DiskRepositoryInterface $disks,
- FolderRepositoryInterface $folders,
- RoleRepositoryInterface $roles,
- UserActivator $activator
- )
- {
- $this->widgets = $widgets;
- $this->menus = $menus;
- $this->users = $users;
- $this->roles = $roles;
- $this->activator = $activator;
- $this->disks = $disks;
- $this->folders = $folders;
- }
+ public function __construct(
+ WidgetRepositoryInterface $widgets,
+ MenuRepositoryInterface $menus,
+ UserRepositoryInterface $users,
+ DiskRepositoryInterface $disks,
+ FolderRepositoryInterface $folders,
+ RoleRepositoryInterface $roles,
+ UserActivator $activator
+ )
+ {
+ $this->widgets = $widgets;
+ $this->menus = $menus;
+ $this->users = $users;
+ $this->roles = $roles;
+ $this->activator = $activator;
+ $this->disks = $disks;
+ $this->folders = $folders;
+ }
- public function run()
- {
+ public function run()
+ {
- $admin = $this->roles->findBySlug('admin');
+ $admin = $this->roles->findBySlug('admin');
- $this->users->unguard();
- $this->users->newQuery()->where('email', "info@openclassify.com")->forceDelete();
- $visiosoft_administrator = $this->users->create(
- [
- 'display_name' => 'openclassify',
- 'email' => "info@openclassify.com",
- 'username' => "openclassify",
- 'password' => "openclassify",
- ]
- );
+ $this->users->unguard();
+ $this->users->newQuery()->where('email', "info@openclassify.com")->forceDelete();
+ $visiosoft_administrator = $this->users->create(
+ [
+ 'display_name' => 'openclassify',
+ 'email' => "info@openclassify.com",
+ 'username' => "openclassify",
+ 'password' => "openclassify",
+ ]
+ );
- $visiosoft_administrator->roles()->sync([$admin->getId()]);
+ $visiosoft_administrator->roles()->sync([$admin->getId()]);
- $this->activator->force($visiosoft_administrator);
+ $this->activator->force($visiosoft_administrator);
- //Footer Link
- LinkModel::query()->forceDelete();
- $repository = new EntryRepository();
- $repository->setModel(new UrlLinkTypeModel());
- $menu = $this->menus->findBySlug('footer');
+ //Footer Link
+ LinkModel::query()->forceDelete();
+ $repository = new EntryRepository();
+ $repository->setModel(new UrlLinkTypeModel());
+ $menu = $this->menus->findBySlug('footer');
- $openclassify = $repository->create(
- [
- 'en' => [
- 'title' => 'OpenClassify.com',
- ],
- 'url' => 'https://openclassify.com/',
- ]
- );
- $visiosoft = $repository->create(
- [
- 'en' => [
- 'title' => 'Visiosoft Inc.',
- ],
- 'url' => 'https://visiosoft.com.tr/',
- ]
- );
+ $openclassify = $repository->create(
+ [
+ 'en' => [
+ 'title' => 'OpenClassify.com',
+ ],
+ 'url' => 'https://openclassify.com/',
+ ]
+ );
+ $visiosoft = $repository->create(
+ [
+ 'en' => [
+ 'title' => 'Visiosoft Inc.',
+ ],
+ 'url' => 'https://visiosoft.com.tr/',
+ ]
+ );
- LinkModel::query()->create(
- [
- 'menu' => $menu,
- 'target' => '_blank',
- 'entry' => $openclassify,
- 'type' => 'anomaly.extension.url_link_type',
- ]
- );
- LinkModel::query()->create(
- [
- 'menu' => $menu,
- 'target' => '_blank',
- 'entry' => $visiosoft,
- 'type' => 'anomaly.extension.url_link_type',
- ]
- );
+ LinkModel::query()->create(
+ [
+ 'menu' => $menu,
+ 'target' => '_blank',
+ 'entry' => $openclassify,
+ 'type' => 'anomaly.extension.url_link_type',
+ ]
+ );
+ LinkModel::query()->create(
+ [
+ 'menu' => $menu,
+ 'target' => '_blank',
+ 'entry' => $visiosoft,
+ 'type' => 'anomaly.extension.url_link_type',
+ ]
+ );
- DB::table('files_files')->truncate();
+ DB::table('files_files')->truncate();
- $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"));
+ $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"));
- Model::unguard();
- DB::unprepared(file_get_contents(storage_path('advs.sql')));
- DB::unprepared(file_get_contents(storage_path('categories.sql')));
- DB::unprepared(file_get_contents(storage_path('settings.sql')));
- Model::reguard();
+ Model::unguard();
+ DB::unprepared(file_get_contents(storage_path('advs.sql')));
+ DB::unprepared(file_get_contents(storage_path('categories.sql')));
+ DB::unprepared(file_get_contents(storage_path('settings.sql')));
+ Model::reguard();
- $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->close();
+ $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->close();
- $this->call(widgetSeeder::class);
+ $this->call(widgetSeeder::class);
- //Create Store Icon Folder
- if (!$this->folders->findBySlug('ads_excel')) {
- $disk = $this->disks->findBySlug('local');
+ //Create Store Icon Folder
+ if (!$this->folders->findBySlug('ads_excel')) {
+ $disk = $this->disks->findBySlug('local');
- $this->folders->create([
- 'en' => [
- 'name' => 'Ads Excel',
- 'description' => 'A folder for Ads Excel.',
- ],
- 'slug' => 'ads_excel',
- 'disk' => $disk
- ]);
- };
- }
+ $this->folders->create([
+ 'en' => [
+ 'name' => 'Ads Excel',
+ 'description' => 'A folder for Ads Excel.',
+ ],
+ 'slug' => 'ads_excel',
+ 'disk' => $disk
+ ]);
+ };
+
+ if ($images_folder = $this->folders->findBySlug('images')) {
+ $images_folder->update([
+ 'allowed_types' => [
+ 'jpg', 'jpeg','png'
+ ],
+ ]);
+ }
+ }
}