Validate only alphanumeric characters in Laravel

后端 未结 4 574
野的像风
野的像风 2021-02-08 17:26

I have the following code in my Laravel 5 app:

public function store(Request $request){
    $this->validate($request,          


        
4条回答
  •  既然无缘
    2021-02-08 18:00

    Might be easiest to use the built in alpha-numeric validation:

    https://laravel.com/docs/5.2/validation#rule-alpha-num
    
    $validator = Validator::make($request->all(), [
        'filename' => 'alpha_num',
    ]);
    

提交回复
热议问题