0

Intro: I'm fairly new to Laravel and MVC.

I am in a process of making all the front-end of the system, which setting up the controller and view files.

Now the system will have users, so I created UsersController for its CRUD, but instead of delete, the users can be archived and un-archive.

Archived users cannot logged in anymore, they will be separated from the database table where the active users are, they can also be un-archive incase they got employed in the future.

How should I tackle this? Any tips?

Roi
  • 503
  • 1
  • 12
  • 25

1 Answers1

0

You do not need to separate users in different parts in database (back-end) side and application (front-end) side, in user table just put a column (status) and change the value of the status column whatever you want: e.g( 1: is archived users, 0: is un-archived users).

Gulmuhammad Akbari
  • 1,986
  • 2
  • 13
  • 28
  • typically this will be the case, but i wanted to separate them so that it will be faster to query active users and generate complicated reports such as payroll – Roi May 23 '17 at 04:27
  • There is no difference for query speed in this case, just in query you will put a condition to filter your users. It is not a good idea for one column, you duplicate a table. – Gulmuhammad Akbari May 23 '17 at 04:30
  • sorry but there is, when record hit millions and 500k of them are supposed to be "archive" its really a boost in speed – Roi May 23 '17 at 04:32
  • You need to index the (`status`) field for speed optimization, its not a big problem. Check this https://stackoverflow.com/questions/3211108/indexing-every-column-in-a-table – Gulmuhammad Akbari May 23 '17 at 04:33