fix hardcoded customer role id
This commit is contained in:
parent
dc6a2b7ba1
commit
3e9be29060
@ -4,6 +4,7 @@ namespace App\Jobs\Common;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Models\Auth\User;
|
||||
use App\Models\Auth\Role;
|
||||
use App\Models\Common\Contact;
|
||||
|
||||
class CreateContact extends Job
|
||||
@ -48,11 +49,14 @@ class CreateContact 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