I have this reference_id variable that I want to use to bar registration on my site. Basically, if you don't input a reference_id that matches correctly one value among a list (~5-10) values then I want to turn them away. Similarly to how if you only put TEST in the email field it stops you and says "Hey that's not a valid email!'.
Where would I put that logic in? I've pasted my RegisterController below as I think it should go there along with the email logic. I could easily make a variable and do something like
$rfid=reference_id
$list=array(list)
if ($rfid==$list) {
allow
}
else {
reject
}
But as you can tell even with that I'm not sure how it would work exactly or where to put it among the rest of the code. Any direction would be appreciated!
RegisterController:
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
'reference_id' => 'max:255',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'reference_id' => $data['reference_id'],
]);
}