Laravel.io
public function authUser( Request $request){

         $v = Validator::extend( 'snils', function($attribute, $value, $parameters){
             $snils = $value;
             if($snils == ''){
                 return false;
             }
             $clear =  preg_replace('/[^0-9]/', null, $snils);
             $serial = substr($clear,0,9);
             $check = substr($clear,9);

             $serial_array = str_split($serial);
             $res = 0;
             foreach( $serial_array as $num => $digit){
                 $res +=  $digit * (9-$num);
             }

             if((int)$res < 100){
                 return (int)$check == $res;
             }
             if((int)$res == 100 || (int)$res == 101){
                 return (int)$check == "00";
             }
             if((int)$res >101){
                 return $check == ($res % 101);
             }
             return false;
         });

         $v->make(
             $request,
             [
                'snils' => 'required|snils|max:255',
                'password' => 'required',
             ]
         );

         if ($v->fails())
         {
             return redirect('register')->withErrors($v);
         }

     }

Please note that all pasted data is publicly available.