@MichalOravec
is it only from controller ? we can not validate from view?
I mean my instructor told to validate it from both controller and view, so I was thinking to convert all the php to html or find away to validate php from the view
@iftekhs is it only from controller ? we can not validate from view? I mean my instructor told to validate it from both controller and view, so I was thinking to convert all the php to html or find away to validate php from the view
@alya_alsiyabi Well I don't think it's possible from the view because the HTML is sent to the client-side what you can do is validate it in the view using javascript. and validate in the controller using the $request->validate([]).
@alya_alsiyabi PHP runs on the server not in the browser - the maxlength attribute will work. But you must be aware that a malicious user can modify the markup, and therefore validate in the Controller (or Form Request) as well
Please note that the character count can be wrong if you allow html input in the field. User does not get to enter as many characters as they think they should because of hidden html. The same for multi-byte characters.