feat: google login
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\SocialProvider;
|
||||
use App\Models\SocialAccount;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<SocialAccount>
|
||||
*/
|
||||
class SocialAccountFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'provider' => fake()->randomElement(SocialProvider::cases()),
|
||||
'provider_user_id' => fake()->uuid(),
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ return new class extends Migration
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('password')->nullable();
|
||||
$table->string('role')->default('user');
|
||||
$table->text('bio')->nullable();
|
||||
$table->unsignedSmallInteger('height')->nullable();
|
||||
@@ -44,6 +44,18 @@ return new class extends Migration
|
||||
$table->foreign('suspended_by')->references('id')->on('users')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::create('social_accounts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignUlid('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('provider', 32);
|
||||
$table->string('provider_user_id');
|
||||
$table->text('provider_refresh_token')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['provider', 'provider_user_id']);
|
||||
$table->unique(['user_id', 'provider']);
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
@@ -65,6 +77,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('social_accounts');
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
|
||||
Reference in New Issue
Block a user