Skip to content

Commit 3840a92

Browse files
authored
Merge pull request #2 from mrprotocoll/auth
Auth
2 parents 0300d7f + 13f4d19 commit 3840a92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1516
-93
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ SUPPORT_EMAIL=
7474

7575
FRONTEND_URL=
7676

77+
CLOUDFLARE_R2_ACCESS_KEY_ID=
78+
CLOUDFLARE_R2_SECRET_ACCESS_KEY=
79+
CLOUDFLARE_R2_BUCKET=
80+
CLOUDFLARE_R2_ENDPOINT=
81+
CLOUDFLARE_R2_URL=
82+

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
"require": {
88
"php": "^8.2",
99
"ext-fileinfo": "*",
10+
"ext-http": "*",
1011
"darkaonline/l5-swagger": "^8.6",
1112
"laravel/breeze": "^2.1",
1213
"laravel/framework": "^11.9",
1314
"laravel/sanctum": "^4.0",
1415
"laravel/socialite": "^5.15",
1516
"laravel/tinker": "^2.9",
16-
"larowka/prevent-duplicate-requests": "^1.1"
17+
"larowka/prevent-duplicate-requests": "^1.1",
18+
"league/flysystem": "^3.0",
19+
"league/flysystem-aws-s3-v3": "^3.0"
1720
},
1821
"require-dev": {
1922
"fakerphp/faker": "^1.23",

config/filesystems.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@
5656
'throw' => false,
5757
],
5858

59+
'uploads' => [
60+
'driver' => 'local',
61+
'root' => storage_path('app/public/uploads'),
62+
'url' => env('APP_URL').'/storage/uploads',
63+
'visibility' => 'public',
64+
],
65+
66+
'r2' => [
67+
'driver' => 's3',
68+
'key' => env('CLOUDFLARE_R2_ACCESS_KEY_ID'),
69+
'secret' => env('CLOUDFLARE_R2_SECRET_ACCESS_KEY'),
70+
'region' => 'auto',
71+
'bucket' => env('CLOUDFLARE_R2_BUCKET'),
72+
'url' => env('CLOUDFLARE_R2_URL'),
73+
'visibility' => 'private',
74+
'endpoint' => env('CLOUDFLARE_R2_ENDPOINT'),
75+
'use_path_style_endpoint' => env('CLOUDFLARE_R2_USE_PATH_STYLE_ENDPOINT', false),
76+
'throw' => false,
77+
],
78+
5979
],
6080

6181
/*

database/migrations/0001_01_01_000000_create_users_table.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ public function up(): void
1616
Schema::create('roles', function (Blueprint $table): void {
1717
$table->id();
1818
$table->string('name');
19+
$table->string('slug')->unique();
20+
$table->text('description')->nullable();
1921
$table->bigInteger('created_at')->useCurrent();
2022
$table->bigInteger('updated_at')->useCurrent();
2123
});
2224

2325
Schema::create('users', function (Blueprint $table): void {
2426
$table->uuid('id')->primary();
25-
$table->string('name');
27+
$table->string('first_name');
28+
$table->string('last_name');
29+
$table->string('avatar')->nullable();
30+
$table->string('phone')->nullable();
2631
$table->string('email')->unique();
2732
$table->timestamp('email_verified_at')->nullable();
2833
$table->string('password');
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Database\Migrations\Migration;
6+
use Illuminate\Database\Schema\Blueprint;
7+
use Illuminate\Support\Facades\Schema;
8+
9+
return new class() extends Migration
10+
{
11+
/**
12+
* Run the migrations.
13+
*/
14+
public function up(): void
15+
{
16+
17+
Schema::create('system_users', function (Blueprint $table): void {
18+
$table->uuid('id')->primary();
19+
$table->string('first_name');
20+
$table->string('last_name');
21+
$table->string('avatar')->nullable();
22+
$table->string('phone')->nullable();
23+
$table->string('email')->unique();
24+
$table->timestamp('email_verified_at')->nullable();
25+
$table->string('password')->nullable();
26+
$table->text('verification_token')->nullable();
27+
$table->boolean('super_admin')->default(false);
28+
$table->dateTime('verification_token_expiry')->nullable();
29+
$table->rememberToken();
30+
$table->string('status')->default('PENDING');
31+
$table->bigInteger('created_at')->useCurrent();
32+
$table->bigInteger('updated_at')->useCurrent();
33+
});
34+
}
35+
36+
/**
37+
* Reverse the migrations.
38+
*/
39+
public function down(): void
40+
{
41+
Schema::dropIfExists('system_users');
42+
}
43+
};

database/migrations/2024_07_01_212031_create_personal_access_tokens_table.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ public function up(): void
1616
$table->uuidMorphs('tokenable');
1717
$table->string('name');
1818
$table->string('token', 64)->unique();
19+
$table->string('refresh_token', 64)->unique();
1920
$table->text('abilities')->nullable();
2021
$table->timestamp('last_used_at')->nullable();
2122
$table->timestamp('expires_at')->nullable();
23+
$table->timestamp('refresh_token_expires_at');
2224
$table->timestamp('created_at')->useCurrent();
2325
$table->timestamp('updated_at')->useCurrent();
2426
});
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Database\Migrations\Migration;
6+
use Illuminate\Database\Schema\Blueprint;
7+
use Illuminate\Support\Facades\Schema;
8+
9+
return new class() extends Migration
10+
{
11+
/**
12+
* Run the migrations.
13+
*/
14+
public function up(): void
15+
{
16+
Schema::create('notifications', function (Blueprint $table): void {
17+
$table->uuid('id')->primary();
18+
$table->string('type');
19+
$table->uuidMorphs('notifiable');
20+
$table->text('data');
21+
$table->timestamp('read_at')->nullable();
22+
$table->timestamps();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*/
29+
public function down(): void
30+
{
31+
Schema::dropIfExists('notifications');
32+
}
33+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('permissions', function (Blueprint $table) {
15+
$table->id();
16+
$table->string('name')->unique();
17+
$table->string('slug')->unique();
18+
$table->text('description')->nullable();
19+
$table->bigInteger('created_at')->useCurrent();
20+
$table->bigInteger('updated_at')->useCurrent();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('permissions');
30+
}
31+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('permission_role', function (Blueprint $table) {
15+
$table->id();
16+
$table->foreignId('permission_id')->constrained()->onDelete('cascade');
17+
$table->foreignId('role_id')->constrained()->onDelete('cascade');
18+
$table->bigInteger('created_at')->useCurrent();
19+
$table->bigInteger('updated_at')->useCurrent();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*/
26+
public function down(): void
27+
{
28+
Schema::dropIfExists('permission_role');
29+
}
30+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('admin_activity_logs', function (Blueprint $table) {
15+
$table->uuid('id')->primary();
16+
$table->foreignUuid('admin_id')->references('id')->on('system_users')->cascadeOnDelete();
17+
$table->string('action');
18+
$table->string('model_type')->nullable(); // e.g., User, Contract
19+
$table->uuid('model_id')->nullable();
20+
$table->json('meta')->nullable(); // Extra metadata
21+
$table->bigInteger('created_at')->useCurrent();
22+
$table->bigInteger('updated_at')->useCurrent();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*/
29+
public function down(): void
30+
{
31+
Schema::dropIfExists('admin_activity_logs');
32+
}
33+
};

0 commit comments

Comments
 (0)