As Shihar says, actually checking whether a name is acceptable / accessible is the responsibility of the model. A controller can provide an action that is invoked by some AJAX on the page, so that when each key is pressed, the text on the page is sent to the action of the dedicated controller, which then checks it through the model (everything related to the database, Model).
There are several things in a view, for example, when a user types, you must cancel previous calls before creating a new one, as this can be confusing.
Also, the controller’s act, which occurs when the user submits the form at the end of data entry, must perform the same check as the AJAX action to avoid race conditions between users.
source share