As a good programmer, you do validation before you submit form info int the database. In Laravel we can do it in two ways. One is on the front end. On the front end in the text input field, we must use the word "required". Once you type in required then if you don't write anything and try to submit the form, you will get a notice that you need to fill int he form text field. And on the back end you must use the method request()->validate(). You can use it like this
Here required means you must type in something. If the field is empty user will be given a notice and form submission will fail. You can include the length as like max:4096. In this case it means not more than 4096 characters. Let's continue..
Well, you can specify max and min together at a time like this
This means you have maximum 255 characters and minimum 20 characters. More than that or less than that will throw and error. But to show error on the front side you need to add a code in the front end. Add the code below
@foreach($errors->all() as $error)