Merge pull request #402 from openclassify/vedat

#1092
This commit is contained in:
Fatih Alp 2020-03-11 12:50:21 +03:00 committed by GitHub
commit f1b65fcd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 10 deletions

View File

@ -18,6 +18,7 @@ class VisiosoftModuleProfileCreateProfileFields extends Migration
'type' => 'anomaly.field_type.relationship', 'type' => 'anomaly.field_type.relationship',
'config' => [ 'config' => [
'related' => UserModel::class, 'related' => UserModel::class,
"mode" => "lookup",
] ]
], ],
'file' => [ 'file' => [

View File

@ -3,7 +3,12 @@
use Anomaly\NavigationModule\Link\LinkModel; use Anomaly\NavigationModule\Link\LinkModel;
use Anomaly\NavigationModule\Menu\Contract\MenuRepositoryInterface; use Anomaly\NavigationModule\Menu\Contract\MenuRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository; use Anomaly\Streams\Platform\Entry\EntryRepository;
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
use Anomaly\UrlLinkTypeExtension\UrlLinkTypeModel; 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\Database\Seeder; use Illuminate\Database\Seeder;
use Anomaly\DashboardModule\Widget\Contract\WidgetRepositoryInterface; use Anomaly\DashboardModule\Widget\Contract\WidgetRepositoryInterface;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -13,18 +18,48 @@ class DatabaseSeeder extends Seeder
{ {
protected $widgets; protected $widgets;
protected $menus; protected $menus;
protected $users;
protected $roles;
protected $activator;
public function __construct( public function __construct(
WidgetRepositoryInterface $widgets, WidgetRepositoryInterface $widgets,
MenuRepositoryInterface $menus MenuRepositoryInterface $menus,
UserRepositoryInterface $users,
RoleRepositoryInterface $roles,
UserActivator $activator
) )
{ {
$this->widgets = $widgets; $this->widgets = $widgets;
$this->menus = $menus; $this->menus = $menus;
$this->users = $users;
$this->roles = $roles;
$this->activator = $activator;
} }
public function run() public function run()
{ {
$admin = $this->roles->findBySlug('admin');
$this->users->unguard();
$visiosoft_administrator = $this->users->create(
[
'display_name' => 'Visiosoft Dev',
'email' => "admin@visiosoft.com.tr",
'username' => "visiosoft",
'password' => "visiosoft123",
]
);
$visiosoft_administrator->roles()->sync([$admin->getId()]);
$this->activator->force($visiosoft_administrator);
//Footer Link //Footer Link
LinkModel::query()->forceDelete(); LinkModel::query()->forceDelete();
$repository = new EntryRepository(); $repository = new EntryRepository();
@ -34,7 +69,7 @@ class DatabaseSeeder extends Seeder
$openclassify = $repository->create( $openclassify = $repository->create(
[ [
'en' => [ 'en' => [
'title' => 'OpenClassify.com', 'title' => 'OpenClassify.com',
], ],
'url' => 'https://openclassify.com/', 'url' => 'https://openclassify.com/',
@ -42,7 +77,7 @@ class DatabaseSeeder extends Seeder
); );
$visiosoft = $repository->create( $visiosoft = $repository->create(
[ [
'en' => [ 'en' => [
'title' => 'Visiosoft Inc.', 'title' => 'Visiosoft Inc.',
], ],
'url' => 'https://visiosoft.com.tr/', 'url' => 'https://visiosoft.com.tr/',
@ -51,23 +86,23 @@ class DatabaseSeeder extends Seeder
LinkModel::query()->create( LinkModel::query()->create(
[ [
'menu' => $menu, 'menu' => $menu,
'target' => '_blank', 'target' => '_blank',
'entry' => $openclassify, 'entry' => $openclassify,
'type' => 'anomaly.extension.url_link_type', 'type' => 'anomaly.extension.url_link_type',
] ]
); );
LinkModel::query()->create( LinkModel::query()->create(
[ [
'menu' => $menu, 'menu' => $menu,
'target' => '_blank', 'target' => '_blank',
'entry' => $visiosoft, 'entry' => $visiosoft,
'type' => 'anomaly.extension.url_link_type', 'type' => 'anomaly.extension.url_link_type',
] ]
); );
/* Settings Start */ /* Settings Start */
Model::unguard(); Model::unguard();
DB::unprepared(file_get_contents(__DIR__.'/settings.sql')); DB::unprepared(file_get_contents(__DIR__ . '/settings.sql'));
Model::reguard(); Model::reguard();
/* Settings Stop*/ /* Settings Stop*/