mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#1947 puan modülü
This commit is contained in:
parent
82c8855e1a
commit
dcb2464079
@ -0,0 +1,13 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Events;
|
||||
|
||||
class UserUpdated
|
||||
{
|
||||
public $oldCustomerInfo;
|
||||
public $changes;
|
||||
|
||||
public function __construct($oldCustomerInfo, $changes)
|
||||
{
|
||||
$this->oldCustomerInfo = $oldCustomerInfo;
|
||||
$this->changes = $changes;
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\ProfileModule\Events\UserUpdated;
|
||||
|
||||
class ProfileFormHandler
|
||||
{
|
||||
@ -30,8 +30,25 @@ class ProfileFormHandler
|
||||
$parameters['file_id'] = null;
|
||||
}
|
||||
|
||||
$userModel->newQuery()->where('id', Auth::id())->update($parameters);
|
||||
$user = $userModel->newQuery()->find(\auth()->id());
|
||||
|
||||
$oldCustomerInfo = $user->toArray();
|
||||
|
||||
$changes = $this->change($user, $parameters);
|
||||
|
||||
event(new UserUpdated($oldCustomerInfo, $changes));
|
||||
|
||||
$messages->success(trans('visiosoft.module.profile::message.success_update'));
|
||||
}
|
||||
|
||||
public function change($user, $data)
|
||||
{
|
||||
$user->fill($data);
|
||||
$changes = $user->getDirty();
|
||||
$user->save();
|
||||
if (count($changes) == 0) {
|
||||
return false;
|
||||
}
|
||||
return $changes;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||
use Anomaly\UsersModule\User\UserModel;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\NotificationsModule\Notify\Notification\UserUpdateEmailMail;
|
||||
use Visiosoft\ProfileModule\Events\UserUpdated;
|
||||
|
||||
class UserFormHandler
|
||||
{
|
||||
@ -24,7 +24,23 @@ class UserFormHandler
|
||||
$user->notify(new UserUpdateEmailMail());
|
||||
}
|
||||
|
||||
$user->update($builder->getPostData());
|
||||
$oldCustomerInfo = $user->toArray();
|
||||
|
||||
$changes = $this->change($user, $data);
|
||||
|
||||
event(new UserUpdated($oldCustomerInfo, $changes));
|
||||
|
||||
$messages->success(trans('visiosoft.module.profile::message.success_update'));
|
||||
}
|
||||
|
||||
public function change($user, $data)
|
||||
{
|
||||
$user->fill($data);
|
||||
$changes = $user->getDirty();
|
||||
$user->save();
|
||||
if (count($changes) == 0) {
|
||||
return false;
|
||||
}
|
||||
return $changes;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user