akaunting 3.0 (the last dance)

This commit is contained in:
Burak Civan
2022-06-01 10:15:55 +03:00
parent cead09f6d4
commit d9c0764572
3812 changed files with 126831 additions and 102949 deletions

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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;
}