Commit ab73d353 authored by Viral Solani's avatar Viral Solani Committed by StyleCI Bot

Apply fixes from StyleCI

parent d31c62e0
...@@ -31,7 +31,7 @@ class StoreUserRequest extends Request ...@@ -31,7 +31,7 @@ class StoreUserRequest extends Request
'first_name' => 'required|max:255', 'first_name' => 'required|max:255',
'last_name' => 'required|max:255', 'last_name' => 'required|max:255',
'email' => ['required', 'email', 'max:255', Rule::unique('users')], 'email' => ['required', 'email', 'max:255', Rule::unique('users')],
'password' => 'required|min:6|confirmed' 'password' => 'required|min:6|confirmed',
]; ];
} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace App\Notifications\Frontend\Auth; namespace App\Notifications\Frontend\Auth;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
/** /**
* Class UserNeedsConfirmation. * Class UserNeedsConfirmation.
......
...@@ -113,17 +113,16 @@ class UserRepository extends BaseRepository ...@@ -113,17 +113,16 @@ class UserRepository extends BaseRepository
} }
/** /**
* Create User * Create User.
* *
* @param Model $request * @param Model $request
*
*/ */
public function create($request) public function create($request)
{ {
$data = $request->except('assignees_roles','permissions'); $data = $request->except('assignees_roles', 'permissions');
$roles = $request->all('assignees_roles'); $roles = $request->all('assignees_roles');
$permissions = $request->all('permissions') ? $request->all('permissions') : []; $permissions = $request->all('permissions') ? $request->all('permissions') : [];
$user = $this->createUserStub($data); $user = $this->createUserStub($data);
DB::transaction(function () use ($user, $data, $roles, $permissions) { DB::transaction(function () use ($user, $data, $roles, $permissions) {
// Set email type 2 // Set email type 2
...@@ -143,7 +142,7 @@ class UserRepository extends BaseRepository ...@@ -143,7 +142,7 @@ class UserRepository extends BaseRepository
$this->attachPermissions($permissions); $this->attachPermissions($permissions);
//Send confirmation email if requested and account approval is off //Send confirmation email if requested and account approval is off
if (isset($data['confirmation_email']) && $user->confirmed == 0 ) { if (isset($data['confirmation_email']) && $user->confirmed == 0) {
$user->notify(new UserNeedsConfirmation($user->confirmation_code)); $user->notify(new UserNeedsConfirmation($user->confirmation_code));
} }
...@@ -411,28 +410,30 @@ class UserRepository extends BaseRepository ...@@ -411,28 +410,30 @@ class UserRepository extends BaseRepository
*/ */
protected function createUserStub($input) protected function createUserStub($input)
{ {
$user = self::MODEL; $user = self::MODEL;
$user = new $user(); $user = new $user();
$user->first_name = $input['first_name']; $user->first_name = $input['first_name'];
$user->last_name = $input['last_name']; $user->last_name = $input['last_name'];
$user->email = $input['email']; $user->email = $input['email'];
$user->password = bcrypt($input['password']); $user->password = bcrypt($input['password']);
$user->status = isset($input['status']) ? 1 : 0; $user->status = isset($input['status']) ? 1 : 0;
$user->confirmation_code = md5(uniqid(mt_rand(), true)); $user->confirmation_code = md5(uniqid(mt_rand(), true));
$user->confirmed = isset($input['confirmed']) ? 1 : 0; $user->confirmed = isset($input['confirmed']) ? 1 : 0;
$user->created_by = access()->user()->id; $user->created_by = access()->user()->id;
return $user; return $user;
} }
/** /**
* Attach Permission * Attach Permission.
* *
* @param $permissions * @param $permissions
*
* @todo attach permission like role * @todo attach permission like role
*
* @return mix * @return mix
*/ */
public function attachPermissions($value='') public function attachPermissions($value = '')
{ {
$arrUserPermissions = []; $arrUserPermissions = [];
if (isset($permissions) && count($permissions) > 0) { if (isset($permissions) && count($permissions) > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment