Skip to content

Commit 56c0332

Browse files
committed
WIP
1 parent 3b50607 commit 56c0332

File tree

14 files changed

+681
-243
lines changed

14 files changed

+681
-243
lines changed

app/Http/Controllers/Public/HomeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function index(Request $request)
8686

8787
// Get stats for filters
8888
$stats = [
89-
'categories' => Category::select(['id', 'name', 'slug'])->orderBy('name')->get(),
89+
'categories' => Category::select(['id', 'name'])->orderBy('name')->get(),
9090
];
9191

9292
return Inertia::render('Public/Home', [

app/Providers/AppServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Providers;
44

55
use Illuminate\Support\ServiceProvider;
6+
use Illuminate\Support\Facades\Event;
67

78
class AppServiceProvider extends ServiceProvider
89
{
@@ -19,6 +20,8 @@ public function register(): void
1920
*/
2021
public function boot(): void
2122
{
22-
//
23+
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
24+
$event->extendSocialite('google', \SocialiteProviders\Google\Provider::class);
25+
});
2326
}
2427
}

bootstrap/providers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
return [
44
App\Providers\AppServiceProvider::class,
5+
\SocialiteProviders\Manager\ServiceProvider::class,
56
];

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"laravel/socialite": "^5.21",
1818
"laravel/tinker": "^2.10.1",
1919
"league/flysystem-aws-s3-v3": "^3.0",
20+
"socialiteproviders/google": "^4.1",
2021
"tightenco/ziggy": "^2.4"
2122
},
2223
"require-dev": {

composer.lock

Lines changed: 116 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/services.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
],
3636
],
3737

38-
'google' => [
39-
'client_id' => env('GOOGLE_CLIENT_ID'),
40-
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
41-
'redirect' => env('APP_URL').'/auth/google/callback',
38+
'google' => [
39+
'client_id' => env('GOOGLE_CLIENT_ID'),
40+
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
41+
'redirect' => env('GOOGLE_REDIRECT_URI')
4242
],
4343

44+
4445
];

database/migrations/2025_06_05_000003_create_categories_table.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public function up(): void
1111
Schema::create('categories', function (Blueprint $table) {
1212
$table->id();
1313
$table->string('name');
14-
$table->string('slug')->unique();
1514
$table->foreignId('parent_id')->nullable()->constrained('categories')->nullOnDelete();
1615
$table->text('description')->nullable();
1716
$table->string('icon')->nullable();

database/seeders/AdminSeeder.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use App\Models\User;
6+
use App\Models\Depot;
7+
use App\Models\Equipment;
8+
use App\Models\Organization;
9+
use Illuminate\Database\Seeder;
10+
use Illuminate\Support\Facades\Hash;
11+
12+
class AdminSeeder extends Seeder
13+
{
14+
/**
15+
* Seed the admin user and his organization.
16+
*/
17+
public function run(): void
18+
{
19+
// Création de Martin comme admin
20+
$martin = User::factory()->create([
21+
'name' => 'Martin',
22+
'email' => 'martin@pegase.io',
23+
'password' => Hash::make('password'),
24+
'is_admin' => true,
25+
]);
26+
27+
// Création de l'organisation de Martin (Pégase)
28+
$pegase = Organization::factory()->create([
29+
'name' => 'Pégase',
30+
'description' => 'Organisation de Martin',
31+
'email' => 'martin@pegase.io',
32+
'website' => 'https://pegase.io',
33+
'owner_id' => $martin->id,
34+
]);
35+
36+
// Mettre à jour l'organisation courante de Martin
37+
$martin->update(['current_organization_id' => $pegase->id]);
38+
39+
// Attacher Martin à son organisation
40+
$martin->organizations()->attach($pegase->id, ['role' => 'admin']);
41+
42+
// Création des dépôts pour Pégase
43+
$pegaseDepots = Depot::factory(1)->create([
44+
'organization_id' => $pegase->id,
45+
]);
46+
47+
// // Création des équipements pour Pégase (répartis dans les catégories)
48+
// foreach (Category::all() as $category) {
49+
// Equipment::factory(4)->create([
50+
// 'organization_id' => $pegase->id,
51+
// 'category_id' => $category->id,
52+
// 'depot_id' => $pegaseDepots->random()->id,
53+
// ]);
54+
// }
55+
}
56+
}

0 commit comments

Comments
 (0)