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\Abstracts\Job;
|
||||||
use App\Models\Auth\User;
|
use App\Models\Auth\User;
|
||||||
|
use App\Models\Auth\Role;
|
||||||
use App\Models\Common\Contact;
|
use App\Models\Common\Contact;
|
||||||
|
|
||||||
class CreateContact extends Job
|
class CreateContact extends Job
|
||||||
@ -48,11 +49,14 @@ class CreateContact 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