akaunting 3.0 (the last dance)
This commit is contained in:
@@ -6,8 +6,9 @@ use App\Abstracts\Job;
|
||||
use App\Interfaces\Job\HasOwner;
|
||||
use App\Interfaces\Job\HasSource;
|
||||
use App\Interfaces\Job\ShouldCreate;
|
||||
use App\Models\Auth\User;
|
||||
use App\Jobs\Auth\CreateUser;
|
||||
use App\Models\Auth\Role;
|
||||
use App\Models\Auth\User;
|
||||
use App\Models\Common\Contact;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -42,16 +43,17 @@ class CreateContact extends Job implements HasOwner, HasSource, ShouldCreate
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
$data = $this->request->all();
|
||||
$data['locale'] = setting('default.locale', 'en-GB');
|
||||
|
||||
$customer_role = Role::all()->filter(function ($role) {
|
||||
return $role->hasPermission('read-client-portal');
|
||||
})->first();
|
||||
})->pluck('id')->toArray();
|
||||
|
||||
$user = User::create($data);
|
||||
$user->roles()->attach($customer_role);
|
||||
$user->companies()->attach($data['company_id']);
|
||||
$this->request->merge([
|
||||
'locale' => setting('default.locale', 'en-GB'),
|
||||
'roles' => $customer_role,
|
||||
'companies' => [$this->request->get('company_id')],
|
||||
]);
|
||||
|
||||
$user = $this->dispatch(new CreateUser($this->request));
|
||||
|
||||
$this->request['user_id'] = $user->id;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,13 @@ class CreateDashboard extends Job implements HasOwner, HasSource, ShouldCreate
|
||||
$sort = 1;
|
||||
|
||||
if ($this->request->has('default_widgets')) {
|
||||
$widgets = Widgets::getClasses($this->request->get('default_widgets'), false);
|
||||
$default_widgets = $this->request->get('default_widgets');
|
||||
|
||||
if (! is_array($default_widgets) && ($default_widgets == 'core')) {
|
||||
Widgets::optimizeCoreWidgets();
|
||||
}
|
||||
|
||||
$widgets = Widgets::getClasses($default_widgets, false);
|
||||
|
||||
$this->createWidgets($widgets, $sort);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Jobs\Common;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Auth\UserCreated;
|
||||
use App\Interfaces\Job\ShouldUpdate;
|
||||
use App\Models\Auth\Role;
|
||||
use App\Models\Auth\User;
|
||||
@@ -66,6 +67,9 @@ class UpdateContact extends Job implements ShouldUpdate
|
||||
$user = User::create($data);
|
||||
$user->roles()->attach($customer_role);
|
||||
$user->companies()->attach($data['company_id']);
|
||||
$this->request->merge(['companies' => array($data['company_id'])]);
|
||||
|
||||
event(new UserCreated($user, $this->request));
|
||||
|
||||
$this->request['user_id'] = $user->id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user