Playing around with a referral system in laravel 5.4. I have been able to create a unique shareable link for each user.
When another user clicks on that, I want the portion of the url with the referral id of the link's original owner to be added to the referrer
field of the user.
I tried this method and been getting this error, what better way is there to do this.
use Illuminate\Support\Facades\Input;
protected function create(array $data)
{
$ref = Input::get('ref');
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'referrer' => $ref
]);
return $user;
}
I am getting an error complaining that the referrer
column cannot be null even though there is a ref on the link. Sample link.
http://localhost:8000/register?ref=1b0a6294-043d-11e7-86bf-56847afe9799
User Model
protected $fillable = [
'name', 'email', 'password', 'level', 'btc_address', 'referrer'
];`
via Bernard Parah