This commit is contained in:
Adrian Hopek
2022-01-12 15:28:48 +01:00
parent 2abd83526d
commit 197e7da9cc
22 changed files with 994 additions and 1895 deletions

View File

@@ -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();
}
}