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