How do I get a user id from the creation of a Validator in Laravel?

Asked

Viewed 35 times

0

public function boot() 
{ 
   //Criação de uma nova validação 

   \Validator::extend('unique_cpf', function ($attribute, $value, 
    $parameters, $validator) { 
          $value = str_replace(['.','-'],'', $value); 
          return ((DB::table('tab_medicos') 
         ->where('med_cpf','=', $value)->where('med_id', '=', 9964) 
         ->count()) == 1); 
   }); 
} 

Instead of the '9964' I want it to be the id, someone can help me?

1 answer

-1

We can take it this way, where we’re getting from the url:

request()->route('id');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.