Skip to content

Commit

Permalink
fix hardcoded customer role id
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jun 5, 2020
1 parent dc6a2b7 commit 3e9be29
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/Jobs/Common/CreateContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Abstracts\Job;
use App\Models\Auth\User;
use App\Models\Auth\Role;
use App\Models\Common\Contact;

class CreateContact extends Job
Expand Down Expand Up @@ -48,11 +49,14 @@ public function createUser()
$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();

$user = User::create($data);
$user->roles()->attach(['3']);
$user->companies()->attach([session('company_id')]);
$user->roles()->attach($customer_role);
$user->companies()->attach(session('company_id'));

// St user id to request
$this->request['user_id'] = $user->id;
}
}

0 comments on commit 3e9be29

Please sign in to comment.