/** * Update roles. * * @param array $inputs * @return void */ public function update($inputs) { foreach ($inputs as $key => $value) { $role = $this->role->where('slug', $key)->firstOrFail(); $role->title = $value; $role->save(); } }
/** * Save the User. * * @param Blog\Models\User $user * @param Array $inputs * @return void */ private function save($user, $inputs) { if (isset($inputs['seen'])) { $user->seen = $inputs['seen'] == 'true'; } else { $user->username = $inputs['username']; $user->email = $inputs['email']; if (isset($inputs['confirmation_code'])) { $user->confirmation_code = $inputs['confirmation_code']; } if (isset($inputs['role'])) { $user->role_id = $inputs['role']; } else { $role_user = $this->role->where('slug', 'user')->first(); if ($role_user != false) { $user->role_id = $role_user->id; } } } $user->save(); }