mongodb and laravel socialite setup

This commit is contained in:
yuriko 🦊 2025-05-20 23:15:38 -04:00
parent 0d952f2967
commit eb72bfe8b9
Signed by: jaiden
SSH key fingerprint: SHA256:f8tvveBoXBrKZIQDWLLcpQrKbATUCGg98x2N4YzkDM8
11 changed files with 406 additions and 22 deletions

View file

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Laravel\Sanctum\PersonalAccessToken as SanctumToken;
use MongoDB\Laravel\Eloquent\DocumentModel;
class PersonalAccessToken extends SanctumToken
{
use DocumentModel;
protected $connection = 'mongodb';
protected $table = 'personal_access_tokens';
protected $keyType = 'string';
}

View file

@ -4,40 +4,28 @@ namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use MongoDB\Laravel\Auth\User as Authenticatable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
protected $connection = 'mongodb';
protected $table = 'users';
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [

View file

@ -2,7 +2,9 @@
namespace App\Providers;
use App\Models\PersonalAccessToken;
use Illuminate\Support\ServiceProvider;
use Laravel\Sanctum\Sanctum;
class AppServiceProvider extends ServiceProvider
{
@ -19,6 +21,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
//
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
}
}