pgsql db connection and testing route added

This commit is contained in:
cbazza committed 2025-10-20 09:53:34 +02:00
1 parent 7503ae7c04
commit d7fc25def6
5 files changed
+49 -44

No files matched your search

+7 -8
View File
@@ -82,14 +82,13 @@ return [
]) : [],
],
'pgsql' => [
'pgsql_second' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'host' => env('DB_HOST2', '127.0.0.1'),
'port' => env('DB_PORT2', '5433'),
'database' => env('DB_DATABASE2', 'laravel'),
'username' => env('DB_USERNAME2', 'root'),
'password' => env('DB_PASSWORD2', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
@@ -147,7 +146,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
'persistent' => env('REDIS_PERSISTENT', false),
],
-28
View File
@@ -1,28 +0,0 @@
<x-layouts.app :title="__('Unternehmensauskunft')">
<div class="flex h-full w-full flex-1 flex-col gap-4 rounded-xl">
<div class="mb-4">
<flux:heading size="xl" class="mb-2">{{ __('Unternehmensauskunft') }}</flux:heading>
<flux:text>{{ __('Suchen Sie nach Unternehmensinformationen') }}</flux:text>
</div>
<div class="mb-6">
<flux:input
type="search"
placeholder="{{ __('Unternehmen suchen...') }}"
class="w-full"
/>
</div>
<div class="grid auto-rows-min gap-4 md:grid-cols-2">
<div class="relative aspect-video overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-700">
<x-placeholder-pattern class="absolute inset-0 size-full stroke-gray-900/20 dark:stroke-neutral-100/20" />
</div>
<div class="relative aspect-video overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-700">
<x-placeholder-pattern class="absolute inset-0 size-full stroke-gray-900/20 dark:stroke-neutral-100/20" />
</div>
</div>
<div class="relative h-full flex-1 overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-700">
<x-placeholder-pattern class="absolute inset-0 size-full stroke-gray-900/20 dark:stroke-neutral-100/20" />
</div>
</div>
</x-layouts.app>
@@ -24,9 +24,8 @@ new #[Layout('components.layouts.app')] class extends Component {
<flux:input
wire:model="search"
type="search"
placeholder="{{ __('Unternehmen suchen...') }}"
class="w-full"
/>
placeholder="{{ __('Unternehmen suchen....') }}"
class="w-full" />
</div>
<div class="grid auto-rows-min gap-4 md:grid-cols-2">
+21 -2
View File
@@ -1,6 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\DB;
use Laravel\Fortify\Features;
use Livewire\Volt\Volt;
@@ -8,11 +9,29 @@ Route::get('/', function () {
return view('welcome');
})->name('home');
// Test Route für PGSQL - kann beliebig abgeändert werden (zum Testen)
Route::get('/test-zweite-db', function () {
try {
// Eine einfache Abfrage auf der zweiten Verbindung
$result = DB::connection('pgsql_second')->select('SELECT NOW() as current_time');
return response()->json([
'status' => 'Erfolgreich verbunden mit zweiter Datenbank',
'zeitstempel' => $result[0]->current_time
]);
} catch (\Exception $e) {
return response()->json([
'status' => 'Fehler bei der Verbindung',
'meldung' => $e->getMessage()
], 500);
}
});
Route::view('dashboard', 'dashboard')
->middleware(['auth', 'verified'])
->name('dashboard');
Route::view('company-search', 'company-search')
Volt::route('company-search', 'company-search')
->middleware(['auth', 'verified'])
->name('company-search');
@@ -35,4 +54,4 @@ Route::middleware(['auth'])->group(function () {
->name('two-factor.show');
});
require __DIR__.'/auth.php';
require __DIR__ . '/auth.php';
+19 -3
View File
@@ -1,6 +1,7 @@
<?php
use App\Models\User;
use Livewire\Volt\Volt;
test('guests are redirected to the login page', function () {
$response = $this->get(route('company-search'));
@@ -8,10 +9,25 @@ test('guests are redirected to the login page', function () {
});
test('authenticated users can visit the company search page', function () {
$user = User::factory()->create();
$this->actingAs($user);
$this->actingAs(User::factory()->create());
$this->get(route('company-search'))->assertOk();
});
test('company search page displays correctly', function () {
$this->actingAs(User::factory()->create());
$response = $this->get(route('company-search'));
$response->assertSuccessful();
$response->assertSee('Unternehmensauskunft');
$response->assertSee('Suchen Sie nach Unternehmensinformationen');
});
test('search input is wired to component', function () {
$this->actingAs(User::factory()->create());
Volt::test('company-search')
->assertSet('search', '')
->set('search', 'Test Firma')
->assertSet('search', 'Test Firma');
});