Skip to content

Confirm the right behavior of user with deleted_at value #1073

Answered by kenjis
EliMariaaaa asked this question in Q&A
Discussion options

You must be logged in to vote

I created an activate/deactivate functionality for users.

What did you created?

I used the soft delete functionality for deactivation.

What do you mean?

If you use CI4 Model's soft delete feature, it deletes records logically.
If a record has deleted_at datetime, the record is treated as deleted.
So $users->findById([user_id]) returns null.
See https://codeigniter4.github.io/CodeIgniter4/models/model.html#usesoftdeletes

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by EliMariaaaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants