mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#996 Merge profile and users module
This commit is contained in:
parent
2f6823d58e
commit
ee353afc1b
@ -4,7 +4,6 @@ use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
||||
use Anomaly\Streams\Platform\Model\Cloudinary\CloudinaryVideoEntryModel;
|
||||
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
|
||||
use Illuminate\Routing\Route;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
|
||||
class AdvPresenter extends EntryPresenter
|
||||
{
|
||||
|
||||
@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Visiosoft\LocationModule\City\CityRepository;
|
||||
use Visiosoft\StoreModule\User\Contract\UserRepositoryInterface;
|
||||
use function PMA\Util\get;
|
||||
use Sunra\PhpSimple\HtmlDomParser;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
@ -44,8 +45,6 @@ use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||
use Visiosoft\PackagesModule\Package\PackageModel;
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
|
||||
use Anomaly\Streams\Platform\Model\Customfields\CustomfieldsCustomFieldsEntryModel;
|
||||
use Anomaly\Streams\Platform\Model\Customfields\CustomfieldsCustomFieldAdvsEntryModel;
|
||||
@ -57,6 +56,8 @@ use Visiosoft\StoreModule\Ad\AdModel;
|
||||
|
||||
class AdvsController extends PublicController
|
||||
{
|
||||
private $userRepository;
|
||||
|
||||
private $adv_model;
|
||||
private $adv_repository;
|
||||
|
||||
@ -71,9 +72,6 @@ class AdvsController extends PublicController
|
||||
|
||||
private $village_model;
|
||||
|
||||
private $profile_model;
|
||||
private $profile_repository;
|
||||
|
||||
private $category_model;
|
||||
private $category_repository;
|
||||
|
||||
@ -82,6 +80,8 @@ class AdvsController extends PublicController
|
||||
private $event;
|
||||
|
||||
public function __construct(
|
||||
UserRepositoryInterface $userRepository,
|
||||
|
||||
AdvModel $advModel,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
|
||||
@ -96,9 +96,6 @@ class AdvsController extends PublicController
|
||||
|
||||
VillageModel $village_model,
|
||||
|
||||
ProfileModel $profile_model,
|
||||
ProfileRepositoryInterface $profile_repository,
|
||||
|
||||
CategoryModel $categoryModel,
|
||||
CategoryRepositoryInterface $category_repository,
|
||||
|
||||
@ -109,6 +106,8 @@ class AdvsController extends PublicController
|
||||
Request $request
|
||||
)
|
||||
{
|
||||
$this->userRepository = $userRepository;
|
||||
|
||||
$this->adv_model = $advModel;
|
||||
$this->adv_repository = $advRepository;
|
||||
|
||||
@ -123,10 +122,6 @@ class AdvsController extends PublicController
|
||||
|
||||
$this->village_model = $village_model;
|
||||
|
||||
|
||||
$this->profile_model = $profile_model;
|
||||
$this->profile_repository = $profile_repository;
|
||||
|
||||
$this->category_model = $categoryModel;
|
||||
$this->category_repository = $category_repository;
|
||||
|
||||
@ -262,8 +257,7 @@ class AdvsController extends PublicController
|
||||
}
|
||||
|
||||
if (!empty($param['user'])) {
|
||||
$user = $this->profile_repository->getUser($param['user']);
|
||||
$userProfile = $this->profile_repository->getProfile($user->id);
|
||||
$user = $this->userRepository->find($param['user']);
|
||||
}
|
||||
|
||||
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
||||
@ -271,7 +265,7 @@ class AdvsController extends PublicController
|
||||
$viewType = $this->requestHttp->cookie('viewType');
|
||||
|
||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request', 'param',
|
||||
'user', 'userProfile', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio');
|
||||
'user', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio');
|
||||
|
||||
return $this->viewTypeBasedRedirect($viewType, $compact);
|
||||
}
|
||||
@ -786,14 +780,15 @@ class AdvsController extends PublicController
|
||||
return $this->view->make('theme::addons/anomaly/pages-module/page', compact('cats'));
|
||||
}
|
||||
|
||||
public function map(AdvRepositoryInterface $advRepository,
|
||||
CategoryRepositoryInterface $categories,
|
||||
CountryRepositoryInterface $countries,
|
||||
ProfileRepositoryInterface $profileRepository,
|
||||
Request $request)
|
||||
public function map(
|
||||
AdvRepositoryInterface $advRepository,
|
||||
CategoryRepositoryInterface $categories,
|
||||
CountryRepositoryInterface $countries,
|
||||
Request $request
|
||||
)
|
||||
{
|
||||
|
||||
return $this->index($advRepository, $categories, $countries, $profileRepository, $request, true);
|
||||
return $this->index($advRepository, $categories, $countries, $request, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Http\Controller\Admin;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\EntryModel;
|
||||
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
|
||||
use Anomaly\UsersModule\User\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Visiosoft\LocationModule\Country\CountryModel;
|
||||
use Visiosoft\ProfileModule\Profile\Form\ProfileFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
use Visiosoft\ProfileModule\Profile\Table\ProfileTableBuilder;
|
||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||
|
||||
class ProfileController extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* Display an index of existing entries.
|
||||
*
|
||||
* @param ProfileTableBuilder $table
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function index(ProfileTableBuilder $table)
|
||||
{
|
||||
$table->setColumns([
|
||||
'email' => [
|
||||
'value' => function (EntryModel $entry) {
|
||||
$user = User::query()->find($entry->id);
|
||||
if (!is_null($user))
|
||||
return $user->email;
|
||||
}
|
||||
],
|
||||
'gsm_phone'
|
||||
]);
|
||||
return $table->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry.
|
||||
*
|
||||
* @param ProfileFormBuilder $form
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function edit(ProfileFormBuilder $form, $id)
|
||||
{
|
||||
$users = UsersUsersEntryModel::find($id);
|
||||
$profiles = ProfileModel::query()->where('user_id', $id)->orderBy("id")->first();
|
||||
if ($profiles == null) {
|
||||
$newProfile = [];
|
||||
$newProfile ['user_id'] = $id;
|
||||
$newProfile ['country_id'] = null;
|
||||
ProfileModel::query()->create($newProfile);
|
||||
$profiles = ProfileModel::query()->where('user_id', $id)->orderBy("id")->first();
|
||||
}
|
||||
$country = CountryModel::all();
|
||||
return $this->view->make('visiosoft.module.profile::admin.profile.edit', compact('users', 'profiles', 'country', 'form'));
|
||||
}
|
||||
|
||||
public function update(ProfileFormBuilder $form, Request $request, $id)
|
||||
{
|
||||
$all = $request->all();
|
||||
if ($all['email'] == "" OR $all['username'] == "") {
|
||||
$error = [];
|
||||
if ($all['email'] == "") {
|
||||
$error[] = trans('visiosoft.module.profile::message.email');
|
||||
}
|
||||
if ($all['username'] == "") {
|
||||
$error[] = trans('visiosoft.module.profile::message.username');
|
||||
}
|
||||
return Redirect::back()->with('error', $error);
|
||||
}
|
||||
|
||||
$userModule = [];
|
||||
$userModule['email'] = $all['email'];
|
||||
$userModule['username'] = $all['username'];
|
||||
$userModule['display_name'] = $all['display_name'];
|
||||
$userModule['first_name'] = $all['first_name'];
|
||||
$userModule['last_name'] = $all['last_name'];
|
||||
$userModule['activated'] = $all['activated'];
|
||||
$userModule['enabled'] = $all['enabled'];
|
||||
UsersUsersEntryModel::query()->find($id)->update($userModule);
|
||||
foreach ($userModule as $key => $val) {
|
||||
unset($all[$key]);
|
||||
}
|
||||
$all['file_id'] = $all['file'];
|
||||
unset($all['file']);
|
||||
unset($all['_token'], $all['action']);
|
||||
ProfileModel::query()->where('user_id', $id)->update($all);
|
||||
$message = [];
|
||||
$message[] = trans('visiosoft.module.profile::message.success_update');
|
||||
return redirect('admin/profile')->with('success', $message);
|
||||
}
|
||||
}
|
||||
@ -42,12 +42,9 @@ use Visiosoft\PackagesModule\User\UserModel;
|
||||
use Visiosoft\ProfileModule\Adress\AdressModel;
|
||||
use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Adress\Form\AdressFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Profile\Form\ProfileFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
|
||||
class MyProfileController extends PublicController
|
||||
{
|
||||
private $adressRepository;
|
||||
@ -316,8 +313,7 @@ class MyProfileController extends PublicController
|
||||
{
|
||||
$all = $request->all();
|
||||
unset($all['_']);
|
||||
$profileModel = new ProfileModel();
|
||||
$status = $profileModel->getProfile(Auth::id())->update($all);
|
||||
$status = $this->userRepository->newQuery()->where('id', Auth::id())->update($all);
|
||||
return response()->json($status);
|
||||
|
||||
}
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Command;
|
||||
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
|
||||
class FindUserProfile
|
||||
{
|
||||
|
||||
/**
|
||||
* @var $id
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* GetProduct constructor.
|
||||
* @param $id
|
||||
*/
|
||||
public function __construct($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProfileRepositoryInterface $profileRepository
|
||||
* @return |null
|
||||
*/
|
||||
public function handle(ProfileRepositoryInterface $profileRepository)
|
||||
{
|
||||
if ($this->id) {
|
||||
return $profileRepository->findByUserID($this->id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Contract;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||
|
||||
interface ProfileInterface extends EntryInterface
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Contract;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||
|
||||
interface ProfileRepositoryInterface extends EntryRepositoryInterface
|
||||
{
|
||||
public function getUser($id);
|
||||
|
||||
public function getProfile($id);
|
||||
|
||||
public function validPasswordByEmail($email);
|
||||
|
||||
public function validPasswordByUsername($username);
|
||||
|
||||
public function updateUserField($fields);
|
||||
|
||||
public function changePassword($fields, $password);
|
||||
|
||||
public function findByUserID($id);
|
||||
|
||||
public function CheckPhoneNumber($phoneNumber);
|
||||
|
||||
public function findPhoneNumber($phone_number);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Event;
|
||||
|
||||
|
||||
class SiteStatusControl
|
||||
{
|
||||
public function __construct($request,$settings)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Handler;
|
||||
|
||||
use Anomaly\SelectFieldType\SelectFieldType;
|
||||
|
||||
class registerType
|
||||
{
|
||||
public function handle(SelectFieldType $fieldType)
|
||||
{
|
||||
$fieldType->setOptions(
|
||||
[
|
||||
'1' => trans('visiosoft.module.profile::field.individual.name'),
|
||||
'2' => trans('visiosoft.module.profile::field.corporate.name')
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Password;
|
||||
|
||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
|
||||
|
||||
class PasswordFormBuilder extends FormBuilder
|
||||
|
||||
@ -2,17 +2,14 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||
use Anomaly\UsersModule\User\User;
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
use Anomaly\UsersModule\User\UserPassword;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class PasswordFormHandler
|
||||
{
|
||||
public function handle(
|
||||
PasswordFormBuilder $builder,
|
||||
MessageBag $messages,
|
||||
UserModel $userModel,
|
||||
UserPassword $userPassword
|
||||
|
||||
)
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||
|
||||
class ProfileCollection extends EntryCollection
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||
|
||||
class ProfileCriteria extends EntryCriteria
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileInterface;
|
||||
use Anomaly\Streams\Platform\Model\Profile\ProfileProfileEntryModel;
|
||||
|
||||
class ProfileModel extends ProfileProfileEntryModel implements ProfileInterface
|
||||
{
|
||||
public function getProfile($id = null)
|
||||
{
|
||||
if($id != null) {
|
||||
return $this->query()->where('user_id', $id);
|
||||
}
|
||||
return $this->query();
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||
|
||||
class ProfileObserver extends EntryObserver
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,148 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
|
||||
use Anomaly\UsersModule\User\Password\Command\SendResetEmail;
|
||||
use Anomaly\UsersModule\User\Password\Command\StartPasswordReset;
|
||||
use Anomaly\UsersModule\User\Password\ForgotPasswordFormHandler;
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
use Anomaly\UsersModule\User\UserPassword;
|
||||
use function CoffeeScript\t;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Visiosoft\ProfileModule\Http\Controller\MyProfileController;
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||
|
||||
class ProfileRepository extends EntryRepository implements ProfileRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* The entry model.
|
||||
*
|
||||
* @var ProfileModel
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Create a new ProfileRepository instance.
|
||||
*
|
||||
* @param ProfileModel $model
|
||||
*/
|
||||
public function __construct(ProfileModel $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function getUser($id)
|
||||
{
|
||||
return UsersUsersEntryModel::query()->where('users_users.id', $id)->first();
|
||||
}
|
||||
|
||||
public function getProfile($id)
|
||||
{
|
||||
return ProfileModel::query()->where('user_id', $id)->first();
|
||||
}
|
||||
|
||||
public function findUserForLogin($field, $val)
|
||||
{
|
||||
$user = UserModel::query()->where($field, $val)->first();
|
||||
if ($user == null) {
|
||||
$profile = $this->findProfileForLogin('gsm_phone', $val);
|
||||
if ($profile != null) {
|
||||
$user = UserModel::query()->find($profile->user_id);
|
||||
}
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function findProfileForLogin($field, $val)
|
||||
{
|
||||
return ProfileModel::query()->where($field, $val)->first();
|
||||
}
|
||||
|
||||
public function validPasswordByEmail($email)
|
||||
{
|
||||
return $this->oldUserSendForgotMail($this->findUserForLogin('email', $email));
|
||||
}
|
||||
|
||||
public function validPasswordByUsername($username)
|
||||
{
|
||||
return $this->oldUserSendForgotMail($this->findUserForLogin('username', $username));
|
||||
}
|
||||
|
||||
public function oldUserSendForgotMail($user)
|
||||
{
|
||||
if ($user == null) {
|
||||
return "noUser";
|
||||
}
|
||||
if ($user->password == "alp236330" OR $user->password == "") {
|
||||
if ($user->email == "user2019" . $user->id . "@mail.com") {
|
||||
return "noMail";
|
||||
}
|
||||
$users = new UserPassword();
|
||||
$users->send($user, '/');
|
||||
return "reset";
|
||||
}
|
||||
return "yes";
|
||||
}
|
||||
|
||||
public function updateUserField($fields)
|
||||
{
|
||||
$userModule = [];
|
||||
$userModule['display_name'] = $fields['first_name'] . " " . $fields['last_name'];
|
||||
$userModule['first_name'] = $fields['first_name'];
|
||||
$userModule['last_name'] = $fields['last_name'];
|
||||
//Core User Module
|
||||
UsersUsersEntryModel::query()->find(Auth::id())->update($userModule);
|
||||
foreach ($userModule as $key => $val) {
|
||||
unset($fields[$key]);
|
||||
}
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
public function changePassword($fields, $userPassword)
|
||||
{
|
||||
if ($fields['new_password'] != $fields['re_new_password']) {
|
||||
$errorList[] = trans('anomaly.module.users::field.confirm_password.name');
|
||||
$fields['error'] = $errorList;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
$validator = $userPassword->validate($fields['new_password']);
|
||||
$errorList = array();
|
||||
foreach ($validator->errors()->all() as $error) {
|
||||
$errorList[] = $error;
|
||||
}
|
||||
if (count($errorList) != 0) {
|
||||
$fields['error'] = $errorList;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
UsersUsersEntryModel::query()->find(Auth::id())->update(['password' => Hash::make($fields['new_password'])]);
|
||||
unset($fields['new_password'], $fields['re_new_password'], $fields['confirm_password_input']);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function findByUserID($id)
|
||||
{
|
||||
return $this->model->where('user_id', $id)->first();
|
||||
}
|
||||
|
||||
public function CheckPhoneNumber($phoneNumber)
|
||||
{
|
||||
return $this->model
|
||||
->where('gsm_phone', $phoneNumber)
|
||||
->where('user_id','!=', Auth::id())
|
||||
->first();
|
||||
}
|
||||
|
||||
public function findPhoneNumber($phone_number)
|
||||
{
|
||||
return $this->model->where('gsm_phone', $phone_number)
|
||||
->first();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
||||
|
||||
class ProfileRouter extends EntryRouter
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile;
|
||||
|
||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||
|
||||
class ProfileSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the seeder.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -41,9 +41,6 @@ class Register2FormBuilder extends FormBuilder
|
||||
'username' => [
|
||||
'required' => true,
|
||||
],
|
||||
'phone' => [
|
||||
'type' => 'anomaly.field_type.text',
|
||||
],
|
||||
'first_name' => [
|
||||
'instructions' => false,
|
||||
'required' => true,
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
use Anomaly\UsersModule\User\Event\UserHasRegistered;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
use Anomaly\UsersModule\User\UserActivator;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Profile\Table;
|
||||
|
||||
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||
|
||||
class ProfileTableBuilder extends TableBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* The table views.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $views = [];
|
||||
|
||||
/**
|
||||
* The table filters.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $filters = [
|
||||
'search' => [
|
||||
'filter' => 'search',
|
||||
'fields' => [
|
||||
'gsm_phone',
|
||||
'land_phone','office_phone','register_type',
|
||||
'identification_number',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The table columns.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $columns = [
|
||||
'username','first_name','last_name'
|
||||
];
|
||||
|
||||
/**
|
||||
* The table buttons.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $buttons = [
|
||||
'go_user'=> [
|
||||
'type' => 'info',
|
||||
'icon' => 'fa fa-user',
|
||||
'href' => '/admin/users/edit/{entry.user_id}'
|
||||
],
|
||||
'edit' => [
|
||||
'text' => 'visiosoft.module.profile::button.go_profile'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The table actions.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $actions = [
|
||||
'delete'
|
||||
];
|
||||
|
||||
/**
|
||||
* The table options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* The table assets.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $assets = [];
|
||||
|
||||
}
|
||||
@ -6,7 +6,6 @@ use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Profile\SignIn\SignInFormBuilder;
|
||||
|
||||
|
||||
@ -14,13 +13,11 @@ class ValidateCredentials
|
||||
{
|
||||
public function __construct(
|
||||
ExtensionCollection $extensions,
|
||||
UserRepositoryInterface $userRepository,
|
||||
ProfileRepositoryInterface $profileRepository
|
||||
UserRepositoryInterface $userRepository
|
||||
)
|
||||
{
|
||||
$this->extensions = $extensions;
|
||||
$this->repository = $userRepository;
|
||||
$this->profile = $profileRepository;
|
||||
}
|
||||
|
||||
public function authenticate(array $credentials)
|
||||
|
||||
@ -25,13 +25,6 @@ class ProfileModule extends Module
|
||||
* @var array
|
||||
*/
|
||||
protected $sections = [
|
||||
'profile' => [
|
||||
'buttons' => [
|
||||
'new_profile'=> [
|
||||
'href' => 'admin/users/create',
|
||||
],
|
||||
],
|
||||
],
|
||||
'adress' => [
|
||||
'buttons' => [
|
||||
'new_adress',
|
||||
|
||||
@ -2,28 +2,15 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
||||
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
|
||||
use Visiosoft\ProfileModule\Profile\Command\FindUserProfile;
|
||||
|
||||
class ProfileModulePlugin extends Plugin
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new \Twig_SimpleFunction(
|
||||
'findUserProfile',
|
||||
function ($id) {
|
||||
|
||||
if (!$ad = $this->dispatch(new FindUserProfile($id))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ad;
|
||||
}
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
'getAddress',
|
||||
function ($id) {
|
||||
|
||||
@ -3,9 +3,6 @@
|
||||
use Anomaly\FilesModule\Disk\Contract\DiskRepositoryInterface;
|
||||
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Chumper\Zipper\Zipper;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Visiosoft\ProfileModule\Seed\UsersFieldsSeeder;
|
||||
|
||||
class ProfileModuleSeeder extends Seeder
|
||||
@ -47,46 +44,20 @@ class ProfileModuleSeeder extends Seeder
|
||||
// Users Fields Seeder
|
||||
$this->call(UsersFieldsSeeder::class);
|
||||
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
if (is_null($this->folders->findBy('slug', 'favicon'))) {
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'ADV LISTING PAGE IMAGE',
|
||||
'description' => 'A folder for adv listing page images.',
|
||||
],
|
||||
'slug' => 'adv_listing_page',
|
||||
'disk' => $disk,
|
||||
'allowed_types' => [
|
||||
'png',
|
||||
'jpeg',
|
||||
'jpg',
|
||||
],
|
||||
]);
|
||||
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'Favicon',
|
||||
'description' => 'A folder for Favicon.',
|
||||
],
|
||||
'slug' => 'favicon',
|
||||
'disk' => $disk,
|
||||
'allowed_types' => [
|
||||
'ico','png',
|
||||
],
|
||||
]);
|
||||
|
||||
$repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/";
|
||||
file_put_contents(__DIR__ . "/advListingPage.sql", fopen($repository . "advListingPage.sql", 'r'));
|
||||
file_put_contents("adv_listing_page.zip", fopen($repository . "adv_listing_page.zip", 'r'));
|
||||
$zipper = new Zipper();
|
||||
$zipper->make('adv_listing_page.zip')->folder('adv_listing_page')->extractTo(base_path() . '/public/app/default/files-module/local/adv_listing_page/');
|
||||
$zipper->close();
|
||||
|
||||
Model::unguard();
|
||||
DB::unprepared(file_get_contents(__DIR__ . '/advListingPage.sql'));
|
||||
Model::reguard();
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'Favicon',
|
||||
'description' => 'A folder for Favicon.',
|
||||
],
|
||||
'slug' => 'favicon',
|
||||
'disk' => $disk,
|
||||
'allowed_types' => [
|
||||
'ico','png',
|
||||
],
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,12 +6,8 @@ use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Adress\AdressRepository;
|
||||
use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel;
|
||||
use Visiosoft\ProfileModule\Adress\AdressModel;
|
||||
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Profile\Password\PasswordFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\Profile\ProfileFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileRepository;
|
||||
use Anomaly\Streams\Platform\Model\Profile\ProfileProfileEntryModel;
|
||||
use Visiosoft\ProfileModule\Profile\ProfileModel;
|
||||
use Illuminate\Routing\Router;
|
||||
use Visiosoft\ProfileModule\Profile\Register2\Register2FormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\SignIn\SignInFormBuilder;
|
||||
@ -64,11 +60,11 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
|
||||
/*Address */
|
||||
'admin/profile/adress' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@index',
|
||||
'admin/profile/adress/create' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@create',
|
||||
'admin/profile/adress/edit/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@adresList',
|
||||
'admin/profile/adress/editAdress/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@edit',
|
||||
'admin/profile/adress/update/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@adressupdate',
|
||||
'admin/profile' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@index',
|
||||
'admin/profile/create' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@create',
|
||||
'admin/profile/edit/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@adresList',
|
||||
'admin/profile/editAdress/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@edit',
|
||||
'admin/profile/update/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\AdressController@adressupdate',
|
||||
'profile/adress/update/{id}' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressUpdate',
|
||||
'profile/address' => [
|
||||
'as' => 'profile::address',
|
||||
@ -100,9 +96,6 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
|
||||
/* Profile */
|
||||
'admin/profile' => 'Visiosoft\ProfileModule\Http\Controller\Admin\ProfileController@index',
|
||||
'admin/profile/edit/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\ProfileController@edit',
|
||||
'admin/profile/update/{id}' => 'Visiosoft\ProfileModule\Http\Controller\Admin\ProfileController@update',
|
||||
'profile/edit' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@edit',
|
||||
'profile/update' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@update',
|
||||
'profile' => [
|
||||
@ -190,7 +183,6 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
'profile' => ProfileFormBuilder::class,
|
||||
'signIn' => SignInFormBuilder::class,
|
||||
ProfileAdressEntryModel::class => AdressModel::class,
|
||||
ProfileProfileEntryModel::class => ProfileModel::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -200,7 +192,6 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
*/
|
||||
protected $singletons = [
|
||||
AdressRepositoryInterface::class => AdressRepository::class,
|
||||
ProfileRepositoryInterface::class => ProfileRepository::class,
|
||||
'register2' => Register2FormBuilder::class,
|
||||
'sites' => SitesFormBuilder::class,
|
||||
];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user