Skip to content

Commit 79e0c66

Browse files
committed
chore: setup improvements & fixes
1 parent 6a29503 commit 79e0c66

5 files changed

Lines changed: 34 additions & 29 deletions

File tree

testbench.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
- APP_DEBUG=true
99
- SESSION_DRIVER=database
1010
- CACHE_STORE=database
11-
- QUEUE_CONNECTION=database
11+
- QUEUE_CONNECTION=sync
1212

1313
providers:
1414
- Workbench\App\Providers\WorkbenchServiceProvider

workbench/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SESSION_SAME_SITE=lax
3838

3939
BROADCAST_CONNECTION=log
4040
FILESYSTEM_DISK=local
41-
QUEUE_CONNECTION=database
41+
QUEUE_CONNECTION=sync
4242

4343
CACHE_STORE=array
4444
# CACHE_PREFIX=

workbench/app/Http/Middleware/AutoLogin.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,10 @@ class AutoLogin
1818
{
1919
public function handle(Request $request, Closure $next)
2020
{
21-
Log::debug('[Workbench] AutoLogin middleware triggered', [
22-
'env' => config('app.env'),
23-
'authenticated' => Auth::check(),
24-
'guard' => config('auth.defaults.guard'),
25-
'path' => $request->path(),
26-
]);
27-
2821
if (config('app.env') === 'local' && ! Auth::guard('web')->check()) {
29-
$dbPath = config('database.connections.sqlite.database');
30-
$userCount = (int) DB::table('users')->count();
31-
Log::debug('[Workbench] AutoLogin DB info', [
32-
'sqlite_path' => $dbPath,
33-
'sqlite_exists' => is_string($dbPath) ? file_exists($dbPath) : null,
34-
'users_count' => $userCount,
35-
]);
36-
3722
$user = User::query()->first();
38-
Log::debug('[Workbench] AutoLogin user lookup', ['found' => (bool) $user]);
3923

4024
if (! $user) {
41-
Log::warning('[Workbench] AutoLogin could not find any users to login — creating default admin user');
4225
try {
4326
$user = User::query()->firstOrCreate(
4427
['email' => 'test@example.com'],
@@ -49,19 +32,16 @@ public function handle(Request $request, Closure $next)
4932
],
5033
);
5134
} catch (\Throwable $e) {
35+
Log::error('[Workbench] AutoLogin user creation failed', ['message' => $e->getMessage()]);
5236
// In case of a race/unique constraint, fetch the existing one
5337
$user = User::query()->where('email', 'test@example.com')->first();
5438
}
55-
if ($user) {
56-
Log::info('[Workbench] AutoLogin ensured default user exists', ['user_id' => $user->id]);
57-
}
5839
}
5940

6041
if ($user) {
6142
$this->bootstrapPermissionsAndAssign($user);
6243
Auth::guard('web')->login($user);
6344
$request->session()->regenerate();
64-
Log::info('[Workbench] AutoLogin successfully logged in user', ['user_id' => $user->id]);
6545

6646
if ($request->is('admin/login')) {
6747
return redirect()->to('/admin');
@@ -85,7 +65,6 @@ private function bootstrapPermissionsAndAssign(User $user): void
8565
'--all' => true,
8666
'--panel' => 'admin',
8767
]);
88-
Log::info('[Workbench] Generated Shield permissions');
8968
}
9069

9170
// Reset caches/registrar to ensure guards are picked up

workbench/app/Providers/WorkbenchServiceProvider.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Workbench\App\Providers;
44

55
use Illuminate\Support\ServiceProvider;
6-
use Workbench\Database\Seeders\DatabaseSeeder;
76

87
class WorkbenchServiceProvider extends ServiceProvider
98
{
@@ -18,10 +17,6 @@ public function register(): void
1817
$this->app->register(\Filament\FilamentServiceProvider::class);
1918
$this->app->register(AdminPanelProvider::class);
2019
$this->app->register(AuthServiceProvider::class);
21-
22-
$this->app->bind('DatabaseSeeder', function ($app) {
23-
return new DatabaseSeeder;
24-
});
2520
}
2621

2722
/**
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('notifications', function (Blueprint $table) {
15+
$table->uuid('id')->primary();
16+
$table->string('type');
17+
$table->morphs('notifiable');
18+
$table->text('data');
19+
$table->timestamp('read_at')->nullable();
20+
$table->timestamps();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('notifications');
30+
}
31+
};

0 commit comments

Comments
 (0)