Added extension system

This commit is contained in:
Constantin Graf
2024-03-04 18:42:52 +01:00
parent 504908ecd7
commit bb42b0940a
13 changed files with 590 additions and 94 deletions

View File

@@ -73,3 +73,5 @@ VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
NGINX_HOST_NAME=solidtime.test
NETWORK_NAME=reverse-proxy-docker-traefik_routing
FORWARD_DB_PORT=5432
FORWARD_WEB_PORT=8083

6
.gitignore vendored
View File

@@ -26,4 +26,8 @@ yarn-error.log
/blob-report/
/playwright/.cache/
/coverage
/extensions/*
/extensions
!/extensions/.gitkeep
!/extensions/extensions_autoload.php
/auth.json
/modules_statuses.json

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Web;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
class HomeController extends Controller
{
public function index(): RedirectResponse
{
if (Auth::check()) {
return redirect()->route('dashboard');
} else {
return redirect('login');
}
}
}

View File

@@ -17,10 +17,12 @@
"laravel/jetstream": "^5.0",
"laravel/passport": "^12.0",
"laravel/tinker": "^2.8",
"nwidart/laravel-modules": "^11.0.3",
"pxlrbt/filament-environment-indicator": "^2.0",
"spatie/temporary-directory": "^2.2",
"tightenco/ziggy": "^2.1.0",
"tpetry/laravel-postgresql-enhanced": "^0.37.0"
"tpetry/laravel-postgresql-enhanced": "^0.37.0",
"wikimedia/composer-merge-plugin": "^2.1.0"
},
"require-dev": {
"brianium/paratest": "^7.3",
@@ -41,7 +43,10 @@
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"files": [
"extensions/extensions_autoload.php"
]
},
"autoload-dev": {
"psr-4": {
@@ -104,7 +109,8 @@
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
"php-http/discovery": true,
"wikimedia/composer-merge-plugin": true
}
},
"minimum-stability": "stable",

305
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5fba69cdc5c5883dc10412fb2f747740",
"content-hash": "0d266d7fff6c64ebfeb3d234fc5b0b60",
"packages": [
{
"name": "anourvalar/eloquent-serialize",
@@ -1431,16 +1431,16 @@
},
{
"name": "filament/actions",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/actions.git",
"reference": "8523fabf8d48301d80023d3955bc2d21e52b1e2f"
"reference": "1a177564e1f707315ac9aee7cc4d345fbc1ea37e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/actions/zipball/8523fabf8d48301d80023d3955bc2d21e52b1e2f",
"reference": "8523fabf8d48301d80023d3955bc2d21e52b1e2f",
"url": "https://api.github.com/repos/filamentphp/actions/zipball/1a177564e1f707315ac9aee7cc4d345fbc1ea37e",
"reference": "1a177564e1f707315ac9aee7cc4d345fbc1ea37e",
"shasum": ""
},
"require": {
@@ -1480,20 +1480,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-21T22:43:16+00:00"
"time": "2024-04-01T18:41:00+00:00"
},
{
"name": "filament/filament",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/panels.git",
"reference": "08673dba066dcb54cf9019596ffea3d79997496c"
"reference": "2dba8d47a87f9fadb65fb6422e813bcb845e60fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/panels/zipball/08673dba066dcb54cf9019596ffea3d79997496c",
"reference": "08673dba066dcb54cf9019596ffea3d79997496c",
"url": "https://api.github.com/repos/filamentphp/panels/zipball/2dba8d47a87f9fadb65fb6422e813bcb845e60fc",
"reference": "2dba8d47a87f9fadb65fb6422e813bcb845e60fc",
"shasum": ""
},
"require": {
@@ -1545,20 +1545,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-23T20:58:51+00:00"
"time": "2024-04-01T18:41:06+00:00"
},
{
"name": "filament/forms",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/forms.git",
"reference": "c864c8ac34e1372964d2d4e9595d10ddaabf88c8"
"reference": "25a1f9b93f27865608e727c47d677ce0b44ad043"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/forms/zipball/c864c8ac34e1372964d2d4e9595d10ddaabf88c8",
"reference": "c864c8ac34e1372964d2d4e9595d10ddaabf88c8",
"url": "https://api.github.com/repos/filamentphp/forms/zipball/25a1f9b93f27865608e727c47d677ce0b44ad043",
"reference": "25a1f9b93f27865608e727c47d677ce0b44ad043",
"shasum": ""
},
"require": {
@@ -1601,20 +1601,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-23T23:27:26+00:00"
"time": "2024-04-01T18:40:59+00:00"
},
{
"name": "filament/infolists",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/infolists.git",
"reference": "64d1ed73e05eebb688e343348e126a038169c7d0"
"reference": "cf5a23020b219bd5e3d930c24e9b380a004206c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/infolists/zipball/64d1ed73e05eebb688e343348e126a038169c7d0",
"reference": "64d1ed73e05eebb688e343348e126a038169c7d0",
"url": "https://api.github.com/repos/filamentphp/infolists/zipball/cf5a23020b219bd5e3d930c24e9b380a004206c8",
"reference": "cf5a23020b219bd5e3d930c24e9b380a004206c8",
"shasum": ""
},
"require": {
@@ -1652,20 +1652,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-23T23:27:28+00:00"
"time": "2024-04-01T18:41:04+00:00"
},
{
"name": "filament/notifications",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/notifications.git",
"reference": "f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5"
"reference": "0739152934bd238b838e1abd1d3c9b037f9e6da3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/notifications/zipball/f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5",
"reference": "f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5",
"url": "https://api.github.com/repos/filamentphp/notifications/zipball/0739152934bd238b838e1abd1d3c9b037f9e6da3",
"reference": "0739152934bd238b838e1abd1d3c9b037f9e6da3",
"shasum": ""
},
"require": {
@@ -1704,20 +1704,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-19T00:28:12+00:00"
"time": "2024-04-01T18:40:59+00:00"
},
{
"name": "filament/support",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/support.git",
"reference": "05c0c56bdb66226dc8d239ac91bc973a0dd33edb"
"reference": "7b156b35791a7ff990621ec59fc8ec8cfdbb0782"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/support/zipball/05c0c56bdb66226dc8d239ac91bc973a0dd33edb",
"reference": "05c0c56bdb66226dc8d239ac91bc973a0dd33edb",
"url": "https://api.github.com/repos/filamentphp/support/zipball/7b156b35791a7ff990621ec59fc8ec8cfdbb0782",
"reference": "7b156b35791a7ff990621ec59fc8ec8cfdbb0782",
"shasum": ""
},
"require": {
@@ -1733,6 +1733,7 @@
"spatie/color": "^1.5",
"spatie/invade": "^1.0|^2.0",
"spatie/laravel-package-tools": "^1.9",
"symfony/console": "^6.0|^7.0",
"symfony/html-sanitizer": "^6.1|^7.0"
},
"type": "library",
@@ -1761,20 +1762,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-23T20:59:06+00:00"
"time": "2024-04-01T18:41:17+00:00"
},
{
"name": "filament/tables",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/tables.git",
"reference": "b58dbfd4b3f4da6708e67a4ca0512bc914faa991"
"reference": "38bf31ffed24ca98647879eb99bdb1efc788b4ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/tables/zipball/b58dbfd4b3f4da6708e67a4ca0512bc914faa991",
"reference": "b58dbfd4b3f4da6708e67a4ca0512bc914faa991",
"url": "https://api.github.com/repos/filamentphp/tables/zipball/38bf31ffed24ca98647879eb99bdb1efc788b4ec",
"reference": "38bf31ffed24ca98647879eb99bdb1efc788b4ec",
"shasum": ""
},
"require": {
@@ -1814,20 +1815,20 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-23T20:59:09+00:00"
"time": "2024-04-01T18:41:19+00:00"
},
{
"name": "filament/widgets",
"version": "v3.2.60",
"version": "v3.2.62",
"source": {
"type": "git",
"url": "https://github.com/filamentphp/widgets.git",
"reference": "38a011b9a556a2786028eb80aa135e171569d2af"
"reference": "23c69ba79ba9f39429e48327676db3117585a5f8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filamentphp/widgets/zipball/38a011b9a556a2786028eb80aa135e171569d2af",
"reference": "38a011b9a556a2786028eb80aa135e171569d2af",
"url": "https://api.github.com/repos/filamentphp/widgets/zipball/23c69ba79ba9f39429e48327676db3117585a5f8",
"reference": "23c69ba79ba9f39429e48327676db3117585a5f8",
"shasum": ""
},
"require": {
@@ -1858,7 +1859,7 @@
"issues": "https://github.com/filamentphp/filament/issues",
"source": "https://github.com/filamentphp/filament"
},
"time": "2024-03-14T10:54:33+00:00"
"time": "2024-04-01T18:41:27+00:00"
},
{
"name": "firebase/php-jwt",
@@ -2735,16 +2736,16 @@
},
{
"name": "laravel/framework",
"version": "v11.1.0",
"version": "v11.1.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "4a9195f68b529b20fe01e24864f99991459c48d4"
"reference": "1437cea6d2b04cbc83743fbb208e1a01efccd9ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/4a9195f68b529b20fe01e24864f99991459c48d4",
"reference": "4a9195f68b529b20fe01e24864f99991459c48d4",
"url": "https://api.github.com/repos/laravel/framework/zipball/1437cea6d2b04cbc83743fbb208e1a01efccd9ec",
"reference": "1437cea6d2b04cbc83743fbb208e1a01efccd9ec",
"shasum": ""
},
"require": {
@@ -2936,7 +2937,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2024-03-26T15:17:39+00:00"
"time": "2024-03-28T15:07:18+00:00"
},
{
"name": "laravel/jetstream",
@@ -4508,16 +4509,16 @@
},
{
"name": "nesbot/carbon",
"version": "3.1.1",
"version": "3.2.3",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "34ccf6f6b49c915421c7886c88c0cb77f3ebbfd2"
"reference": "4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/34ccf6f6b49c915421c7886c88c0cb77f3ebbfd2",
"reference": "34ccf6f6b49c915421c7886c88c0cb77f3ebbfd2",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1",
"reference": "4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1",
"shasum": ""
},
"require": {
@@ -4535,14 +4536,14 @@
"require-dev": {
"doctrine/dbal": "^3.6.3 || ^4.0",
"doctrine/orm": "^2.15.2 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.18.0",
"kylekatarnls/multi-tester": "^2.2.0",
"ondrejmirtes/better-reflection": "^6.11.0.0",
"phpmd/phpmd": "^2.13.0",
"phpstan/extension-installer": "^1.3.0",
"phpstan/phpstan": "^1.10.20",
"phpunit/phpunit": "^10.2.2",
"squizlabs/php_codesniffer": "^3.7.2"
"friendsofphp/php-cs-fixer": "^3.52.1",
"kylekatarnls/multi-tester": "^2.5.3",
"ondrejmirtes/better-reflection": "^6.25.0.4",
"phpmd/phpmd": "^2.15.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.65",
"phpunit/phpunit": "^10.5.15",
"squizlabs/php_codesniffer": "^3.9.0"
},
"bin": [
"bin/carbon"
@@ -4610,7 +4611,7 @@
"type": "tidelift"
}
],
"time": "2024-03-13T12:42:37+00:00"
"time": "2024-03-30T18:22:00+00:00"
},
{
"name": "nette/schema",
@@ -4906,6 +4907,92 @@
],
"time": "2024-03-06T16:17:14+00:00"
},
{
"name": "nwidart/laravel-modules",
"version": "v11.0.3",
"source": {
"type": "git",
"url": "https://github.com/nWidart/laravel-modules.git",
"reference": "24c5ca340cf9d5cb8d71ebc27e8a5ac70e599a87"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/24c5ca340cf9d5cb8d71ebc27e8a5ac70e599a87",
"reference": "24c5ca340cf9d5cb8d71ebc27e8a5ac70e599a87",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=8.2",
"wikimedia/composer-merge-plugin": "^2.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.52",
"laravel/framework": "^v11.0",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^v9.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^11.0",
"spatie/phpunit-snapshot-assertions": "^5.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Nwidart\\Modules\\LaravelModulesServiceProvider"
],
"aliases": {
"Module": "Nwidart\\Modules\\Facades\\Module"
}
},
"branch-alias": {
"dev-master": "11.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Nwidart\\Modules\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com",
"homepage": "https://nicolaswidart.com",
"role": "Developer"
}
],
"description": "Laravel Module management",
"keywords": [
"laravel",
"module",
"modules",
"nwidart",
"rad"
],
"support": {
"issues": "https://github.com/nWidart/laravel-modules/issues",
"source": "https://github.com/nWidart/laravel-modules/tree/v11.0.3"
},
"funding": [
{
"url": "https://github.com/dcblogdev",
"type": "github"
},
{
"url": "https://github.com/nwidart",
"type": "github"
}
],
"time": "2024-03-24T23:33:15+00:00"
},
{
"name": "nyholm/psr7",
"version": "1.8.1",
@@ -9536,6 +9623,62 @@
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
},
"time": "2022-06-03T18:03:27+00:00"
},
{
"name": "wikimedia/composer-merge-plugin",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/wikimedia/composer-merge-plugin.git",
"reference": "a03d426c8e9fb2c9c569d9deeb31a083292788bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/a03d426c8e9fb2c9c569d9deeb31a083292788bc",
"reference": "a03d426c8e9fb2c9c569d9deeb31a083292788bc",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1||^2.0",
"php": ">=7.2.0"
},
"require-dev": {
"composer/composer": "^1.1||^2.0",
"ext-json": "*",
"mediawiki/mediawiki-phan-config": "0.11.1",
"php-parallel-lint/php-parallel-lint": "~1.3.1",
"phpspec/prophecy": "~1.15.0",
"phpunit/phpunit": "^8.5||^9.0",
"squizlabs/php_codesniffer": "~3.7.1"
},
"type": "composer-plugin",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
},
"class": "Wikimedia\\Composer\\Merge\\V2\\MergePlugin"
},
"autoload": {
"psr-4": {
"Wikimedia\\Composer\\Merge\\V2\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bryan Davis",
"email": "bd808@wikimedia.org"
}
],
"description": "Composer plugin to merge multiple composer.json files",
"support": {
"issues": "https://github.com/wikimedia/composer-merge-plugin/issues",
"source": "https://github.com/wikimedia/composer-merge-plugin/tree/v2.1.0"
},
"time": "2023-04-15T19:07:00+00:00"
}
],
"packages-dev": [
@@ -10745,16 +10888,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.65",
"version": "1.10.66",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6"
"reference": "94779c987e4ebd620025d9e5fdd23323903950bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6",
"reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd",
"reference": "94779c987e4ebd620025d9e5fdd23323903950bd",
"shasum": ""
},
"require": {
@@ -10803,7 +10946,7 @@
"type": "tidelift"
}
],
"time": "2024-03-23T10:30:26+00:00"
"time": "2024-03-28T16:17:31+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -11130,16 +11273,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.0.8",
"version": "11.0.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "48ea58408879a9aad630022186398364051482fc"
"reference": "591bbfe416400385527d5086b346b92c06de404b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/48ea58408879a9aad630022186398364051482fc",
"reference": "48ea58408879a9aad630022186398364051482fc",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/591bbfe416400385527d5086b346b92c06de404b",
"reference": "591bbfe416400385527d5086b346b92c06de404b",
"shasum": ""
},
"require": {
@@ -11210,7 +11353,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.8"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.9"
},
"funding": [
{
@@ -11226,7 +11369,7 @@
"type": "tidelift"
}
],
"time": "2024-03-22T04:21:01+00:00"
"time": "2024-03-28T10:09:42+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -12284,16 +12427,16 @@
},
{
"name": "spatie/ignition",
"version": "1.12.0",
"version": "1.13.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/ignition.git",
"reference": "5b6f801c605a593106b623e45ca41496a6e7d56d"
"reference": "889bf1dfa59e161590f677728b47bf4a6893983b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/ignition/zipball/5b6f801c605a593106b623e45ca41496a6e7d56d",
"reference": "5b6f801c605a593106b623e45ca41496a6e7d56d",
"url": "https://api.github.com/repos/spatie/ignition/zipball/889bf1dfa59e161590f677728b47bf4a6893983b",
"reference": "889bf1dfa59e161590f677728b47bf4a6893983b",
"shasum": ""
},
"require": {
@@ -12363,20 +12506,20 @@
"type": "github"
}
],
"time": "2024-01-03T15:49:39+00:00"
"time": "2024-03-29T14:03:47+00:00"
},
{
"name": "spatie/laravel-ignition",
"version": "2.4.2",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "351504f4570e32908839fc5a2dc53bf77d02f85e"
"reference": "0c864b3cbd66ce67a2096c5f743e07ce8f1d6ab9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/351504f4570e32908839fc5a2dc53bf77d02f85e",
"reference": "351504f4570e32908839fc5a2dc53bf77d02f85e",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/0c864b3cbd66ce67a2096c5f743e07ce8f1d6ab9",
"reference": "0c864b3cbd66ce67a2096c5f743e07ce8f1d6ab9",
"shasum": ""
},
"require": {
@@ -12386,7 +12529,7 @@
"illuminate/support": "^10.0|^11.0",
"php": "^8.1",
"spatie/flare-client-php": "^1.3.5",
"spatie/ignition": "^1.9",
"spatie/ignition": "^1.13",
"symfony/console": "^6.2.3|^7.0",
"symfony/var-dumper": "^6.2.3|^7.0"
},
@@ -12455,7 +12598,7 @@
"type": "github"
}
],
"time": "2024-02-09T16:08:40+00:00"
"time": "2024-04-02T06:30:22+00:00"
},
{
"name": "symfony/yaml",

234
config/modules.php Normal file
View File

@@ -0,0 +1,234 @@
<?php
declare(strict_types=1);
use Nwidart\Modules\Activators\FileActivator;
use Nwidart\Modules\Providers\ConsoleServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| Module Namespace
|--------------------------------------------------------------------------
|
| Default module namespace.
|
*/
'namespace' => 'Extensions',
/*
|--------------------------------------------------------------------------
| Module Stubs
|--------------------------------------------------------------------------
|
| Default module stubs.
|
*/
'stubs' => [
'enabled' => false,
'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'),
'files' => [
'routes/web' => 'routes/web.php',
'routes/api' => 'routes/api.php',
'views/index' => 'resources/views/index.blade.php',
'views/master' => 'resources/views/layouts/master.blade.php',
'scaffold/config' => 'config/config.php',
'composer' => 'composer.json',
'assets/js/app' => 'resources/assets/js/app.js',
'assets/sass/app' => 'resources/assets/sass/app.scss',
'vite' => 'vite.config.js',
'package' => 'package.json',
],
'replacements' => [
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME'],
'vite' => ['LOWER_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
'views/index' => ['LOWER_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
'scaffold/config' => ['STUDLY_NAME'],
'composer' => [
'LOWER_NAME',
'STUDLY_NAME',
'VENDOR',
'AUTHOR_NAME',
'AUTHOR_EMAIL',
'MODULE_NAMESPACE',
'PROVIDER_NAMESPACE',
],
],
'gitkeep' => true,
],
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path is used to save the generated module.
| This path will also be added automatically to the list of scanned folders.
|
*/
'modules' => base_path('extensions'),
/*
|--------------------------------------------------------------------------
| Modules assets path
|--------------------------------------------------------------------------
|
| Here you may update the modules' assets path.
|
*/
'assets' => public_path('extensions'),
/*
|--------------------------------------------------------------------------
| The migrations' path
|--------------------------------------------------------------------------
|
| Where you run the 'module:publish-migration' command, where do you publish the
| the migration files?
|
*/
'migration' => base_path('database/migrations'),
/*
|--------------------------------------------------------------------------
| Generator path
|--------------------------------------------------------------------------
| Customise the paths where the folders will be generated.
| Setting the generate key to false will not generate that folder
*/
'generator' => [
'config' => ['path' => 'config', 'generate' => true],
'command' => ['path' => 'App/Console', 'generate' => false],
'channels' => ['path' => 'App/Broadcasting', 'generate' => false],
'migration' => ['path' => 'Database/migrations', 'generate' => false],
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
'factory' => ['path' => 'Database/Factories', 'generate' => false],
'model' => ['path' => 'App/Models', 'generate' => false],
'observer' => ['path' => 'App/Observers', 'generate' => false],
'routes' => ['path' => 'routes', 'generate' => true],
'controller' => ['path' => 'App/Http/Controllers', 'generate' => true],
'filter' => ['path' => 'App/Http/Middleware', 'generate' => false],
'request' => ['path' => 'App/Http/Requests', 'generate' => false],
'provider' => ['path' => 'App/Providers', 'generate' => true],
'assets' => ['path' => 'resources/assets', 'generate' => false],
'lang' => ['path' => 'lang', 'generate' => false],
'views' => ['path' => 'resources/views', 'generate' => true],
'test' => ['path' => 'tests/Unit', 'generate' => false],
'test-feature' => ['path' => 'tests/Feature', 'generate' => false],
'repository' => ['path' => 'App/Repositories', 'generate' => false],
'event' => ['path' => 'App/Events', 'generate' => false],
'listener' => ['path' => 'App/Listeners', 'generate' => false],
'policies' => ['path' => 'App/Policies', 'generate' => false],
'rules' => ['path' => 'App/Rules', 'generate' => false],
'jobs' => ['path' => 'App/Jobs', 'generate' => false],
'emails' => ['path' => 'App/Emails', 'generate' => false],
'notifications' => ['path' => 'App/Notifications', 'generate' => false],
'resource' => ['path' => 'App/resources', 'generate' => false],
'component-view' => ['path' => 'resources/views/components', 'generate' => false],
'component-class' => ['path' => 'App/View/Components', 'generate' => false],
],
],
/*
|--------------------------------------------------------------------------
| Package commands
|--------------------------------------------------------------------------
|
| Here you can define which commands will be visible and used in your
| application. You can add your own commands to merge section.
|
*/
'commands' => ConsoleServiceProvider::defaultCommands()
->merge([
// New commands go here
])->toArray(),
/*
|--------------------------------------------------------------------------
| Scan Path
|--------------------------------------------------------------------------
|
| Here you define which folder will be scanned. By default will scan vendor
| directory. This is useful if you host the package in packagist website.
|
*/
'scan' => [
'enabled' => false,
'paths' => [
base_path('vendor/*/*'),
],
],
/*
|--------------------------------------------------------------------------
| Composer File Template
|--------------------------------------------------------------------------
|
| Here is the config for the composer.json file, generated by this package
|
*/
'composer' => [
'vendor' => 'nwidart',
'author' => [
'name' => 'Nicolas Widart',
'email' => 'n.widart@gmail.com',
],
'composer-output' => false,
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| Here is the config for setting up the caching feature.
|
*/
'cache' => [
'enabled' => false,
'driver' => 'file',
'key' => 'laravel-modules',
'lifetime' => 60,
],
/*
|--------------------------------------------------------------------------
| Choose what laravel-modules will register as custom namespaces.
| Setting one to false will require you to register that part
| in your own Service Provider class.
|--------------------------------------------------------------------------
*/
'register' => [
'translations' => true,
/**
* load files on boot or register method
*/
'files' => 'register',
],
/*
|--------------------------------------------------------------------------
| Activators
|--------------------------------------------------------------------------
|
| You can define new types of activators here, file, database, etc. The only
| required parameter is 'class'.
| The file activator will store the activation status in storage/installed_modules
*/
'activators' => [
'file' => [
'class' => FileActivator::class,
'statuses-file' => base_path('modules_statuses.json'),
'cache-key' => 'activator.installed',
'cache-lifetime' => 604800,
],
],
'activator' => 'file',
];

View File

@@ -5,6 +5,8 @@ services:
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
ports:
- '${FORWARD_WEB_PORT:-8083}:80'
image: sail-8.3/app
labels:
- "traefik.enable=true"

0
extensions/.gitkeep Normal file
View File

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
$extensions = array_diff(scandir(__DIR__), ['..', '.', '.gitkeep', 'autoload.php', '.DS_Store']);
foreach ($extensions as $extension) {
$path = __DIR__.DIRECTORY_SEPARATOR.$extension.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
if (file_exists($path)) {
require_once $path;
}
}

View File

@@ -3,9 +3,9 @@
declare(strict_types=1);
use App\Http\Controllers\Web\DashboardController;
use App\Http\Controllers\Web\HomeController;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
/*
|--------------------------------------------------------------------------
@@ -18,14 +18,7 @@ use Inertia\Inertia;
|
*/
Route::get('/', function () {
return Inertia::render('Welcome', [
'canLogin' => Route::has('login'),
'canRegister' => Route::has('register'),
'laravelVersion' => Application::VERSION,
'phpVersion' => PHP_VERSION,
]);
});
Route::get('/', [HomeController::class, 'index']);
Route::middleware([
'auth:web',

View File

@@ -45,6 +45,7 @@ class MemberEndpointTest extends ApiEndpointTestAbstract
]));
// Assert
$response->assertValid();
$response->assertStatus(204);
}

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Endpoint\Web;
use App\Models\User;
class HomeEndpointTest extends EndpointTestAbstract
{
public function test_index_redirects_to_dashboard_if_user_is_logged_in(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
$this->actingAs($user);
// Act
$response = $this->get('/');
// Assert
$response->assertRedirect('/dashboard');
}
public function test_index_redirects_to_login_if_user_is_not_logged_in(): void
{
// Arrange
// Act
$response = $this->get('/');
// Assert
$response->assertRedirect('/login');
}
}

45
vite-module-loader.js Normal file
View File

@@ -0,0 +1,45 @@
import fs from 'fs/promises';
import path from 'path';
async function collectModuleAssetsPaths(paths, modulesPath) {
modulesPath = path.join(__dirname, modulesPath);
const moduleStatusesPath = path.join(__dirname, 'modules_statuses.json');
try {
// Read module_statuses.json
const moduleStatusesContent = await fs.readFile(moduleStatusesPath, 'utf-8');
const moduleStatuses = JSON.parse(moduleStatusesContent);
// Read module directories
const moduleDirectories = await fs.readdir(modulesPath);
for (const moduleDir of moduleDirectories) {
if (moduleDir === '.DS_Store') {
// Skip .DS_Store directory
continue;
}
// Check if the module is enabled (status is true)
if (moduleStatuses[moduleDir] === true) {
const viteConfigPath = path.join(modulesPath, moduleDir, 'vite.config.js');
const stat = await fs.stat(viteConfigPath);
if (stat.isFile()) {
// Import the module-specific Vite configuration
const moduleConfig = await import(viteConfigPath);
if (moduleConfig.paths && Array.isArray(moduleConfig.paths)) {
paths.push(...moduleConfig.paths);
}
}
}
}
} catch (error) {
console.error(`Error reading module statuses or module configurations: ${error}`);
}
return paths;
}
export default collectModuleAssetsPaths;