Fix hardcoded customer role id in UpdateContact Job
This commit is contained in:
parent
f58a8378ed
commit
d87c392259
@ -3,6 +3,7 @@
|
|||||||
namespace App\Jobs\Common;
|
namespace App\Jobs\Common;
|
||||||
|
|
||||||
use App\Abstracts\Job;
|
use App\Abstracts\Job;
|
||||||
|
use App\Models\Auth\Role;
|
||||||
use App\Models\Auth\User;
|
use App\Models\Auth\User;
|
||||||
use App\Models\Common\Contact;
|
use App\Models\Common\Contact;
|
||||||
|
|
||||||
@ -70,11 +71,14 @@ class UpdateContact extends Job
|
|||||||
$data = $this->request->all();
|
$data = $this->request->all();
|
||||||
$data['locale'] = setting('default.locale', 'en-GB');
|
$data['locale'] = setting('default.locale', 'en-GB');
|
||||||
|
|
||||||
$user = User::create($data);
|
$customer_role = Role::all()->filter(function ($role) {
|
||||||
$user->roles()->attach(['3']);
|
return $role->hasPermission('read-client-portal');
|
||||||
$user->companies()->attach([session('company_id')]);
|
})->first();
|
||||||
|
|
||||||
|
$user = User::create($data);
|
||||||
|
$user->roles()->attach($customer_role);
|
||||||
|
$user->companies()->attach(session('company_id'));
|
||||||
|
|
||||||
// St user id to request
|
|
||||||
$this->request['user_id'] = $user->id;
|
$this->request['user_id'] = $user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user