Skip to content

Commit 4b5bf58

Browse files
authored
Merge branch 'main' into dependabot/composer/wire-elements/modal-3.0.2
2 parents b26505d + 9737b8e commit 4b5bf58

File tree

117 files changed

+2019
-2022
lines changed

Some content is hidden

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

117 files changed

+2019
-2022
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ node_modules
44
# Laravel
55
.mcp.json
66
.env.example
7+
.env.testing
78
phpstan.neon
8-
phpunit.xml
9+
phpunit.*.xml
910
rector.php
1011
pint.json
1112
tests

.env.example

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@ APP_NAME="LaravelCameroun"
22
APP_ENV=local
33
APP_KEY=
44
APP_DEBUG=true
5+
APP_DOMAIN=laravelcm.local
56
APP_URL=http://laravelcm.local
7+
ASSET_URL=https://laravelcm.local
68
APP_LOCALE=fr
9+
APP_FALLBACK_LOCALE=fr
710
APP_PORT=8080
811
APP_SERVICE=laravelcm
9-
FILAMENT_PATH=cp
1012

1113
LOG_CHANNEL=stack
1214
LOG_STACK=single,nightwatch
1315
LOG_LEVEL=debug
1416

17+
RAY_HOST=ray@buggregator
18+
RAY_PORT=8000
19+
SENTRY_LARAVEL_DSN=http://sentry@buggregator:8000/1
20+
SENTRY_TRACES_SAMPLE_RATE=1.0
21+
VAR_DUMPER_FORMAT=server
22+
VAR_DUMPER_SERVER=tcp://buggregator:9912
23+
INSPECTOR_URL=http://inspector@buggregator:8000
24+
INSPECTOR_API_KEY=test
25+
INSPECTOR_INGESTION_KEY=1test
26+
INSPECTOR_ENABLE=true
27+
1528
DB_CONNECTION=pgsql
1629
DB_HOST=pgsql
1730
DB_PORT=5432
@@ -20,10 +33,16 @@ DB_USERNAME=sail
2033
DB_PASSWORD=password
2134

2235
BROADCAST_DRIVER=log
23-
CACHE_DRIVER=file
36+
MEDIA_DISK=media
37+
FILESYSTEM_DISK=${MEDIA_DISK}
38+
FILAMENT_FILESYSTEM_DISK=${MEDIA_DISK}
39+
FILAMENT_PATH=cpanel
40+
2441
QUEUE_CONNECTION=database
42+
BROADCAST_CONNECTION=log
43+
CACHE_DRIVER=file
2544
SESSION_DRIVER=database
26-
SESSION_LIFETIME=120
45+
SESSION_LIFETIME=1400
2746

2847
MEMCACHED_HOST=127.0.0.1
2948

@@ -41,10 +60,13 @@ MAIL_FROM_ADDRESS=no-reply@laravel.cm
4160
MAIL_FROM_NAME="${APP_NAME}"
4261
MAIL_SUPPORT=mail-support@laravel.cm
4362

44-
AWS_ACCESS_KEY_ID=
45-
AWS_SECRET_ACCESS_KEY=
63+
AWS_ACCESS_KEY_ID=sail
64+
AWS_SECRET_ACCESS_KEY=password
4665
AWS_DEFAULT_REGION=us-east-1
47-
AWS_BUCKET=
66+
AWS_BUCKET=laravelcm
67+
AWS_ENDPOINT="http://minio:9000"
68+
AWS_URL="http://localhost:9000/laravelcm"
69+
AWS_USE_PATH_STYLE_ENDPOINT=true
4870

4971
PUSHER_APP_ID=
5072
PUSHER_APP_KEY=
@@ -57,39 +79,27 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
5779
GITHUB_CLIENT_ID=
5880
GITHUB_CLIENT_SECRET=
5981
GITHUB_REDIRECT=${APP_URL}/auth/github/callback
60-
82+
GITHUB_FINE_GRAINED_TOKEN=
6183
MARKDOWNX_GIPHY_API_KEY=
6284
TORCHLIGHT_TOKEN=
6385
TORCHLIGHT_THEME=moonlight-ii
64-
UNSPLASH_ACCESS_KEY=
65-
6686
TELEGRAM_BOT_TOKEN=
6787
TELEGRAM_CHANNEL=
68-
69-
MEDIA_DISK=media
70-
FILAMENT_FILESYSTEM_DISK=${MEDIA_DISK}
71-
72-
NOTCHPAY_PUBLIC_KEY=
73-
7488
TWITTER_CONSUMER_KEY=your-consumer-key
7589
TWITTER_CONSUMER_SECRET=your-consumer-secret
7690
TWITTER_ACCESS_TOKEN=your-accesss_token
7791
TWITTER_ACCESS_SECRET=your-access-token-secret
78-
79-
GOOGLE_RECAPTCHA_SITE_KEY=your-recaptcha-site-key
80-
GOOGLE_RECAPTCHA_SECRET_KEY=your-secret-key
81-
82-
GITHUB_FINE_GRAINED_TOKEN=
92+
UNSPLASH_ACCESS_KEY=
93+
NOTCHPAY_PUBLIC_KEY=
94+
NIGHTWATCH_TOKEN=
95+
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1
8396

8497
SCOUT_DRIVER=typesense
8598
TYPESENSE_HOST=typesense
8699
TYPESENSE_PORT=8108
87100
TYPESENSE_PROTOCOL=http
88101
TYPESENSE_API_KEY=xyz
89102

90-
NIGHTWATCH_TOKEN=
91-
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1
92-
93103
# SSH Tunnel Configuration for Database Migration
94104
SSH_TUNNEL_USER=
95105
SSH_TUNNEL_HOSTNAME=

.env.testing

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
APP_NAME="LaravelCameroun"
2+
APP_ENV=testing
3+
APP_KEY=base64:NXoQgjw2ZlOxnGbo5ZRhYgTdM6xLYsgYElNAgcTQJkE=
4+
APP_DEBUG=false
5+
APP_DOMAIN=laravelcm.test
6+
APP_URL=http://laravelcm.test
7+
ASSET_URL=http://laravelcm.test
8+
APP_LOCALE=fr
9+
APP_FALLBACK_LOCALE=fr
10+
11+
LOG_CHANNEL=stack
12+
LOG_STACK=single
13+
LOG_LEVEL=error
14+
15+
DB_CONNECTION=pgsql
16+
DB_HOST=pgsql
17+
DB_PORT=5432
18+
DB_DATABASE=testing
19+
DB_USERNAME=sail
20+
DB_PASSWORD=password
21+
22+
CACHE_DRIVER=array
23+
SESSION_DRIVER=array
24+
QUEUE_CONNECTION=sync
25+
26+
MAIL_MAILER=array
27+
28+
TELESCOPE_ENABLED=false
29+
RAY_ENABLED=false
30+
SENTRY_LARAVEL_DSN=
31+
INSPECTOR_ENABLE=false
32+
33+
BCRYPT_ROUNDS=4
34+
VIEW_COMPILED_PATH=/tmp/views

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ runs:
88
uses: shivammathur/setup-php@v2
99
with:
1010
php-version: "8.4"
11-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
11+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, soap, intl, gd, exif, iconv, imagick
1212
tools: composer:v2
1313
coverage: none
1414
- name: ℹ Setup Problem Matches

.github/workflows/tests.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ jobs:
1515
pest:
1616
runs-on: ubuntu-22.04
1717

18+
services:
19+
postgres:
20+
image: postgres:17-alpine
21+
env:
22+
POSTGRES_PASSWORD: password
23+
POSTGRES_USER: sail
24+
POSTGRES_DB: testing
25+
ports:
26+
- 5432:5432
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
1833
steps:
1934
- name: 👀 Checkout
2035
uses: actions/checkout@v5
@@ -27,4 +42,4 @@ jobs:
2742
- name: 🧱 Build JS Dependencies
2843
run: yarn build
2944
- name: 🕵️‍♂️ Run Pest Tests
30-
run: ./vendor/bin/pest
45+
run: ./vendor/bin/pest --configuration=phpunit.ci.xml --parallel --processes=4 --bail

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ FROM ghcr.io/yieldstudio/php:${PHP_VERSION}-frankenphp AS base
88

99
ENV HEALTHCHECK_PATH="/up"
1010

11-
## Uncomment if you need to install additional PHP extensions
12-
# USER root
13-
# RUN install-php-extensions bcmath gd
14-
1511
############################################
1612
# Development Image
1713
############################################

app-modules/database-migration/src/Commands/ResetPostgresSequencesCommand.php

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Laravelcm\DatabaseMigration\Commands;
66

77
use Illuminate\Console\Command;
8+
use Illuminate\Support\Collection;
89
use Illuminate\Support\Facades\DB;
9-
use Illuminate\Support\Facades\Schema;
1010

1111
final class ResetPostgresSequencesCommand extends Command
1212
{
@@ -25,35 +25,38 @@ public function handle(): int
2525
$this->info('🔄 Resetting PostgreSQL sequences...');
2626
$this->newLine();
2727

28-
$tables = collect(Schema::getTableListing())
29-
->filter(fn (string $table): bool => Schema::hasColumn($table, 'id'))
30-
->filter(fn (string $table): bool => $this->hasSequence($table));
28+
$tablesWithSequences = $this->getTablesWithSequences();
3129

32-
if ($tables->isEmpty()) {
30+
if ($tablesWithSequences->isEmpty()) {
3331
$this->warn('❌ No tables with sequences found');
3432

3533
return Command::SUCCESS;
3634
}
3735

38-
$progressBar = $this->output->createProgressBar($tables->count());
36+
$progressBar = $this->output->createProgressBar($tablesWithSequences->count());
3937
$progressBar->start();
4038

4139
$resetCount = 0;
4240
$skipCount = 0;
4341

44-
foreach ($tables as $table) {
42+
foreach ($tablesWithSequences as $sequenceInfo) {
4543
try {
46-
$maxId = DB::table($table)->max('id') ?? 0;
44+
$tableName = $sequenceInfo->table_name;
45+
$sequenceName = $sequenceInfo->sequence_name;
46+
$columnName = $sequenceInfo->column_name;
47+
48+
$maxId = DB::table($tableName)->max($columnName) ?? 0;
49+
$nextVal = $maxId + 1;
4750

4851
if ($isDryRun) {
49-
$this->line("Would reset {$table}_id_seq to {$maxId}");
52+
$this->line("Would reset {$sequenceName} to {$nextVal} (max {$columnName}: {$maxId})");
5053
} else {
51-
DB::statement("SELECT setval('{$table}_id_seq', COALESCE(MAX(id), 1)) FROM {$table};");
54+
DB::statement('SELECT setval(?, GREATEST(?, 1))', [$sequenceName, $nextVal]);
5255
}
5356

5457
$resetCount++;
5558
} catch (\Exception $e) {
56-
$this->line("⚠️ Skipped {$table}: {$e->getMessage()}");
59+
$this->line("⚠️ Skipped {$sequenceInfo->table_name}: {$e->getMessage()}");
5760
$skipCount++;
5861
}
5962

@@ -72,14 +75,31 @@ public function handle(): int
7275
return Command::SUCCESS;
7376
}
7477

75-
private function hasSequence(string $table): bool
78+
private function getTablesWithSequences(): Collection
7679
{
7780
try {
78-
$result = DB::select("SELECT 1 FROM pg_class WHERE relname = '{$table}_id_seq' AND relkind = 'S'");
79-
80-
return ! empty($result);
81-
} catch (\Exception) {
82-
return false;
81+
$result = DB::select("
82+
SELECT
83+
t.relname AS table_name,
84+
a.attname AS column_name,
85+
s.relname AS sequence_name
86+
FROM pg_class s
87+
JOIN pg_depend d ON d.objid = s.oid
88+
JOIN pg_class t ON d.refobjid = t.oid
89+
JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum)
90+
JOIN pg_namespace n ON n.oid = s.relnamespace
91+
WHERE s.relkind = 'S'
92+
AND d.deptype = 'a'
93+
AND t.relkind = 'r'
94+
AND n.nspname = 'public'
95+
ORDER BY t.relname, a.attname
96+
");
97+
98+
return collect($result);
99+
} catch (\Exception $e) {
100+
$this->warn("Error querying sequences: {$e->getMessage()}");
101+
102+
return collect();
83103
}
84104
}
85105
}

0 commit comments

Comments
 (0)