任何好友在这里帮助我 我面临抵消问题。
$cookie = Cookie::get('referral');
$referred_by = $cookie ? \Hashids::decode($cookie)[0] : null;
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'referred_by' => $referred_by
]);
答案 0 :(得分:1)
$cookie = Cookie::get('referral');
$referred_by = $cookie ? (isset(\Hashids::decode($cookie)[0]) ?? null) : null;
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'referred_by' => $referred_by
]);