Example #1
0
    } else {
        try {
            $user->update($userData, $userId);
        } catch (Exception $e) {
            echo $e;
            $error = true;
        }
        if (!$error) {
            foreach ($oldRoles as $key => $oldRole) {
                if (!in_array($key, $newRoles)) {
                    User::removeFromRole($userId, $key);
                }
            }
            foreach ($newRoles as $key => $newRole) {
                if (!array_key_exists($newRole, $oldRoles)) {
                    User::addToRole($userId, $newRole);
                }
            }
        }
    }
}
if ($password = Input::get('password')) {
    // CHange password
    $salt = Hash::salt(32);
    try {
        $user->update(array('password' => Hash::make($password, $salt), 'salt' => $salt), $userId);
    } catch (Exception $e) {
        print_r($e);
    }
}
if (Input::get('delete')) {