This commit is contained in:
Diatrex 2020-03-12 16:24:45 +03:00
commit edcb1d4620
3 changed files with 48 additions and 11 deletions

View File

@ -79,7 +79,8 @@ class AjaxController extends PublicController
$page_title = trans('visiosoft.module.advs::field.my_adv.name'); $page_title = trans('visiosoft.module.advs::field.my_adv.name');
$my_advs = $my_advs->myAdvsByUser(); $my_advs = $my_advs->myAdvsByUser();
} }
$my_advs = $my_advs->orderByDesc('id'); $my_advs = $my_advs->orderByDesc('id')->select(['id', 'cover_photo', 'slug', 'price',
'currency', 'city', 'country_id', 'cat1', 'cat2', 'status']);
$my_advs = $advRepository->addAttributes($my_advs->get()); $my_advs = $advRepository->addAttributes($my_advs->get());
foreach ($my_advs as $index => $ad) { foreach ($my_advs as $index => $ad) {

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*/