Laravel validation alpha_dash Example

Admin   Laravel   222  2021-03-15 00:00:07

Hi Guys,

Today, I will learn you to create validation alpha_dash in laravel.we will show example of laravel validation alpha_dash.the field under validation may have alpha-numeric characters, as well as dashes and underscores.you can simply apply to validation to alpha_dash validation in laravel.in this validation only allow alpha_dash characters.

Here, I will give you full example for simply alpha_dash validation in laravel bellow.

solution

 

$request->validate([

'name' => 'required|alpha_dash',

]);

Route : routes/web.php

 

Route::get('form/create','[email protected]');

Route::post('form/store','[email protected]')->name('form.store');

Controller : app/Http/Controllers/BlogController.php