#2 - wip
This commit is contained in:
@@ -7,7 +7,15 @@ namespace Toby\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Socialite\Two\User as SocialUser;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $avatar
|
||||
* @property string $google_id
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
@@ -16,15 +24,22 @@ class User extends Authenticatable
|
||||
protected $fillable = [
|
||||
"name",
|
||||
"email",
|
||||
"password",
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
"password",
|
||||
"remember_token",
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
"email_verified_at" => "datetime",
|
||||
];
|
||||
|
||||
public function syncGoogleData(SocialUser $user): void
|
||||
{
|
||||
$this->name = $user->getName();
|
||||
$this->avatar = $user->getAvatar();
|
||||
$this->google_id = $user->getId();
|
||||
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user