Home > database >  reduce data in database using codeigniter 4
reduce data in database using codeigniter 4

Time:02-15

Below is my code snippet. I want to reduce the balance in the database,,But what if I use codeigniter 4?

dd($this->ionAuth->update($this->ionAuth->users()->row()->id, ['balance' => 1000]));

*I'm using ionAuth for updating, it's just as big a burden when updating the database using modeling data.

CodePudding user response:

look here authentcate library for ci4

https://github.com/lonnieezell/myth-auth

go there download it

ionAuth is not compablitablke with ci4

CodePudding user response:

It looks like you intend to use $this->ion_auth->user() instead of $this->ion_auth->users().

Also keep in mind that executing a dump and die on $this->ion_auth->update(...) returns a boolean not the updated user data.

References:

users() gets all users.

users()
Get the users.

Parameters

'Group IDs, group names, or group IDs and names' - array OPTIONAL. If an array of group ids, of group names, or of group ids and names are passed (or a single group id or name) this will return the users in those groups.

Usage

$users = $this->ion_auth->users()->result(); // get all users

user() gets a single user.

user()
Get a user.

Parameters

'Id' - integer OPTIONAL. If a user id is not passed the id of the currently logged in user will be used.

Usage

$user = $this->ion_auth->user()->row();
echo $user->email;
  • Related