From 47b739ada44273225c14cb34641f8a70158bc9d4 Mon Sep 17 00:00:00 2001 From: Alf Drollinger <40421928+adrolli@users.noreply.github.com> Date: Fri, 8 Dec 2023 23:50:38 +0100 Subject: [PATCH] Jobs fixes, more packages (#253) Co-authored-by: KimSpeer Co-authored-by: Kim-the-Diamond --- README.md | 2 +- _custom/README.md | 2 +- _other/README.md | 10 +- _other/art/README.md | 11 +- _packages/README.md | 2 +- _packages/blog/.gitignore | 49 ++ _packages/blog/CHANGELOG.md | 1 + _packages/blog/LICENSE.md | 21 + _packages/blog/README.md | 53 ++- _packages/blog/SECURITY.md | 13 + _packages/blog/composer.json | 37 ++ .../builder.php => blog/config/blog.php} | 10 +- .../migrations/create_blog_table.php.stub} | 4 +- .../blog/resources/lang/de/translations.php | 14 + .../blog/resources/lang/en/translations.php | 14 + .../blog/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../src/BlogPlugin.php} | 24 +- .../src/BlogServiceProvider.php} | 10 +- .../blog/src/Commands/InstallCommand.php | 36 ++ .../Builder.php => blog/src/Models/Blog.php} | 6 +- .../src/Resources/BlogResource.php} | 38 +- .../BlogResource}/Pages/ListPage.php | 16 +- .../BlogResource/Widgets/BlogWidgets.php} | 14 +- _packages/core/README.md | 22 +- _packages/core/SECURITY.md | 2 +- _packages/core/build.php | 278 ------------ _packages/core/composer.json | 8 +- _packages/core/config/core.php | 20 + .../migrations/create_core_table.php.stub | 32 ++ .../core/resources/lang/de/translations.php | 14 +- .../core/resources/lang/en/translations.php | 14 +- .../core/resources/lang/es/translations.php | 14 +- .../core/src/Commands/InstallCommand.php | 16 +- _packages/core/src/CorePlugin.php | 257 +++++++++++ _packages/core/src/CoreServiceProvider.php | 23 + _packages/core/src/Models/Core.php | 23 + _packages/core/src/Resources/CoreResource.php | 126 ++++++ .../Resources/CoreResource/Pages/ListPage.php | 41 ++ .../CoreResource/Widgets/CoreWidgets.php | 30 ++ _packages/data/.gitignore | 49 ++ _packages/data/CHANGELOG.md | 1 + _packages/data/LICENSE.md | 21 + _packages/data/README.md | 52 +++ _packages/data/SECURITY.md | 13 + _packages/data/composer.json | 37 ++ _packages/data/config/data.php | 20 + .../migrations/create_data_table.php.stub | 32 ++ .../data/resources/lang/de/translations.php | 14 + .../data/resources/lang/en/translations.php | 14 + .../data/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../data/src/Commands/InstallCommand.php | 36 ++ _packages/data/src/DataPlugin.php | 257 +++++++++++ _packages/data/src/DataServiceProvider.php | 23 + _packages/data/src/Models/Data.php | 23 + _packages/data/src/Resources/DataResource.php | 126 ++++++ .../Resources/DataResource/Pages/ListPage.php | 41 ++ .../DataResource/Widgets/DataWidgets.php | 30 ++ _packages/file/.gitignore | 49 ++ _packages/file/CHANGELOG.md | 1 + _packages/file/LICENSE.md | 21 + _packages/file/README.md | 52 +++ _packages/file/SECURITY.md | 13 + _packages/file/composer.json | 37 ++ _packages/file/config/file.php | 20 + .../migrations/create_file_table.php.stub | 32 ++ .../file/resources/lang/de/translations.php | 14 + .../file/resources/lang/en/translations.php | 14 + .../file/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../file/src/Commands/InstallCommand.php | 36 ++ _packages/file/src/FilePlugin.php | 257 +++++++++++ _packages/file/src/FileServiceProvider.php | 23 + _packages/file/src/Models/File.php | 23 + _packages/file/src/Resources/FileResource.php | 126 ++++++ .../Resources/FileResource/Pages/ListPage.php | 41 ++ .../FileResource/Widgets/FileWidgets.php | 30 ++ _packages/jobs/README.md | 4 +- _packages/jobs/config/jobs.php | 4 +- .../jobs/resources/lang/de/translations.php | 1 + .../jobs/resources/lang/en/translations.php | 1 + .../jobs/resources/lang/es/translations.php | 2 + .../jobs/resources/lang/fr/translations.php | 2 + _packages/jobs/src/Models/Job.php | 11 - _packages/jobs/src/Models/JobManager.php | 24 +- ...obsResource.php => JobsFailedResource.php} | 4 +- .../Pages/ListFailedJobs.php | 6 +- .../JobsResource/Widgets/JobStatsOverview.php | 13 +- ...bsResource.php => JobsWaitingResource.php} | 8 +- .../Pages/ListJobsWaiting.php | 8 +- .../Widgets/JobsWaitingOverview.php | 14 +- _packages/logs/.gitignore | 49 ++ _packages/logs/CHANGELOG.md | 1 + _packages/logs/LICENSE.md | 21 + _packages/logs/README.md | 52 +++ _packages/logs/SECURITY.md | 13 + _packages/logs/composer.json | 37 ++ _packages/logs/config/logs.php | 20 + .../migrations/create_logs_table.php.stub | 32 ++ .../logs/resources/lang/de/translations.php | 14 + .../logs/resources/lang/en/translations.php | 14 + .../logs/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../logs/src/Commands/InstallCommand.php | 36 ++ _packages/logs/src/LogsPlugin.php | 257 +++++++++++ _packages/logs/src/LogsServiceProvider.php | 23 + _packages/logs/src/Models/Logs.php | 23 + _packages/logs/src/Resources/LogsResource.php | 126 ++++++ .../Resources/LogsResource/Pages/ListPage.php | 41 ++ .../LogsResource/Widgets/LogsWidgets.php | 30 ++ _packages/page/.gitignore | 49 ++ _packages/page/CHANGELOG.md | 1 + _packages/page/LICENSE.md | 21 + _packages/page/README.md | 52 +++ _packages/page/SECURITY.md | 13 + _packages/page/composer.json | 37 ++ _packages/page/config/page.php | 20 + .../migrations/create_page_table.php.stub | 32 ++ .../page/resources/lang/de/translations.php | 14 + .../page/resources/lang/en/translations.php | 14 + .../page/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../page/src/Commands/InstallCommand.php | 36 ++ _packages/page/src/Models/Page.php | 23 + _packages/page/src/PagePlugin.php | 257 +++++++++++ _packages/page/src/PageServiceProvider.php | 23 + _packages/page/src/Resources/PageResource.php | 126 ++++++ .../Resources/PageResource/Pages/ListPage.php | 41 ++ .../PageResource/Widgets/PageWidgets.php | 30 ++ _packages/user/.gitignore | 49 ++ _packages/user/CHANGELOG.md | 1 + _packages/user/LICENSE.md | 21 + _packages/user/README.md | 52 +++ _packages/user/SECURITY.md | 13 + _packages/user/composer.json | 37 ++ _packages/user/config/user.php | 20 + .../migrations/create_user_table.php.stub | 32 ++ .../user/resources/lang/de/translations.php | 14 + .../user/resources/lang/en/translations.php | 14 + .../user/resources/lang/es/translations.php | 14 + .../resources/lang/nb_NO/translations.php | 14 + .../user/src/Commands/InstallCommand.php | 36 ++ _packages/user/src/Models/User.php | 23 + _packages/user/src/Resources/UserResource.php | 126 ++++++ .../Resources/UserResource/Pages/ListPage.php | 41 ++ .../UserResource/Widgets/UserWidgets.php | 30 ++ _packages/user/src/UserPlugin.php | 257 +++++++++++ _packages/user/src/UserServiceProvider.php | 23 + app/Providers/Filament/AdminPanelProvider.php | 15 + composer.json | 37 +- composer.lock | 421 ++++++++++++++++-- config/blog.php | 20 + config/core.php | 20 + config/data.php | 20 + config/file.php | 20 + config/logs.php | 20 + config/{tallui.php => moox.php} | 2 +- config/page.php | 20 + config/user.php | 20 + .../2023_12_08_153354_create_blog_table.php | 31 ++ .../2023_12_08_153405_create_core_table.php | 31 ++ .../2023_12_08_153414_create_data_table.php | 31 ++ .../2023_12_08_153423_create_file_table.php | 31 ++ .../2023_12_08_153438_create_logs_table.php | 31 ++ .../2023_12_08_153446_create_page_table.php | 31 ++ .../2023_12_08_153454_create_user_table.php | 31 ++ phpstan.neon.dist | 17 +- .../js/filament/forms/components/key-value.js | 2 +- resources/views/custom/overview.blade.php | 2 +- resources/views/welcome.blade.php | 2 +- routes/web.php | 4 +- 172 files changed, 5856 insertions(+), 525 deletions(-) create mode 100644 _packages/blog/.gitignore create mode 100644 _packages/blog/CHANGELOG.md create mode 100644 _packages/blog/LICENSE.md create mode 100644 _packages/blog/SECURITY.md create mode 100644 _packages/blog/composer.json rename _packages/{core/config/builder.php => blog/config/blog.php} (57%) rename _packages/{core/database/migrations/create_builder_table.php.stub => blog/database/migrations/create_blog_table.php.stub} (86%) create mode 100644 _packages/blog/resources/lang/de/translations.php create mode 100644 _packages/blog/resources/lang/en/translations.php create mode 100644 _packages/blog/resources/lang/es/translations.php create mode 100644 _packages/blog/resources/lang/nb_NO/translations.php rename _packages/{core/src/BuilderPlugin.php => blog/src/BlogPlugin.php} (83%) rename _packages/{core/src/BuilderServiceProvider.php => blog/src/BlogServiceProvider.php} (63%) create mode 100644 _packages/blog/src/Commands/InstallCommand.php rename _packages/{core/src/Models/Builder.php => blog/src/Models/Blog.php} (76%) rename _packages/{core/src/Resources/BuilderResource.php => blog/src/Resources/BlogResource.php} (69%) rename _packages/{core/src/Resources/BuilderResource => blog/src/Resources/BlogResource}/Pages/ListPage.php (62%) rename _packages/{core/src/Resources/BuilderResource/Widgets/BuilderWidgets.php => blog/src/Resources/BlogResource/Widgets/BlogWidgets.php} (51%) delete mode 100644 _packages/core/build.php create mode 100644 _packages/core/config/core.php create mode 100644 _packages/core/database/migrations/create_core_table.php.stub create mode 100644 _packages/core/src/CorePlugin.php create mode 100644 _packages/core/src/CoreServiceProvider.php create mode 100644 _packages/core/src/Models/Core.php create mode 100644 _packages/core/src/Resources/CoreResource.php create mode 100644 _packages/core/src/Resources/CoreResource/Pages/ListPage.php create mode 100644 _packages/core/src/Resources/CoreResource/Widgets/CoreWidgets.php create mode 100644 _packages/data/.gitignore create mode 100644 _packages/data/CHANGELOG.md create mode 100644 _packages/data/LICENSE.md create mode 100644 _packages/data/README.md create mode 100644 _packages/data/SECURITY.md create mode 100644 _packages/data/composer.json create mode 100644 _packages/data/config/data.php create mode 100644 _packages/data/database/migrations/create_data_table.php.stub create mode 100644 _packages/data/resources/lang/de/translations.php create mode 100644 _packages/data/resources/lang/en/translations.php create mode 100644 _packages/data/resources/lang/es/translations.php create mode 100644 _packages/data/resources/lang/nb_NO/translations.php create mode 100644 _packages/data/src/Commands/InstallCommand.php create mode 100644 _packages/data/src/DataPlugin.php create mode 100644 _packages/data/src/DataServiceProvider.php create mode 100644 _packages/data/src/Models/Data.php create mode 100644 _packages/data/src/Resources/DataResource.php create mode 100644 _packages/data/src/Resources/DataResource/Pages/ListPage.php create mode 100644 _packages/data/src/Resources/DataResource/Widgets/DataWidgets.php create mode 100644 _packages/file/.gitignore create mode 100644 _packages/file/CHANGELOG.md create mode 100644 _packages/file/LICENSE.md create mode 100644 _packages/file/README.md create mode 100644 _packages/file/SECURITY.md create mode 100644 _packages/file/composer.json create mode 100644 _packages/file/config/file.php create mode 100644 _packages/file/database/migrations/create_file_table.php.stub create mode 100644 _packages/file/resources/lang/de/translations.php create mode 100644 _packages/file/resources/lang/en/translations.php create mode 100644 _packages/file/resources/lang/es/translations.php create mode 100644 _packages/file/resources/lang/nb_NO/translations.php create mode 100644 _packages/file/src/Commands/InstallCommand.php create mode 100644 _packages/file/src/FilePlugin.php create mode 100644 _packages/file/src/FileServiceProvider.php create mode 100644 _packages/file/src/Models/File.php create mode 100644 _packages/file/src/Resources/FileResource.php create mode 100644 _packages/file/src/Resources/FileResource/Pages/ListPage.php create mode 100644 _packages/file/src/Resources/FileResource/Widgets/FileWidgets.php rename _packages/jobs/src/Resources/{FailedJobsResource.php => JobsFailedResource.php} (98%) rename _packages/jobs/src/Resources/{FailedJobsResource => JobsFailedResource}/Pages/ListFailedJobs.php (88%) rename _packages/jobs/src/Resources/{WaitingJobsResource.php => JobsWaitingResource.php} (94%) rename _packages/jobs/src/Resources/{WaitingJobsResource => JobsWaitingResource}/Pages/ListJobsWaiting.php (63%) rename _packages/jobs/src/Resources/{WaitingJobsResource => JobsWaitingResource}/Widgets/JobsWaitingOverview.php (62%) create mode 100644 _packages/logs/.gitignore create mode 100644 _packages/logs/CHANGELOG.md create mode 100644 _packages/logs/LICENSE.md create mode 100644 _packages/logs/README.md create mode 100644 _packages/logs/SECURITY.md create mode 100644 _packages/logs/composer.json create mode 100644 _packages/logs/config/logs.php create mode 100644 _packages/logs/database/migrations/create_logs_table.php.stub create mode 100644 _packages/logs/resources/lang/de/translations.php create mode 100644 _packages/logs/resources/lang/en/translations.php create mode 100644 _packages/logs/resources/lang/es/translations.php create mode 100644 _packages/logs/resources/lang/nb_NO/translations.php create mode 100644 _packages/logs/src/Commands/InstallCommand.php create mode 100644 _packages/logs/src/LogsPlugin.php create mode 100644 _packages/logs/src/LogsServiceProvider.php create mode 100644 _packages/logs/src/Models/Logs.php create mode 100644 _packages/logs/src/Resources/LogsResource.php create mode 100644 _packages/logs/src/Resources/LogsResource/Pages/ListPage.php create mode 100644 _packages/logs/src/Resources/LogsResource/Widgets/LogsWidgets.php create mode 100644 _packages/page/.gitignore create mode 100644 _packages/page/CHANGELOG.md create mode 100644 _packages/page/LICENSE.md create mode 100644 _packages/page/README.md create mode 100644 _packages/page/SECURITY.md create mode 100644 _packages/page/composer.json create mode 100644 _packages/page/config/page.php create mode 100644 _packages/page/database/migrations/create_page_table.php.stub create mode 100644 _packages/page/resources/lang/de/translations.php create mode 100644 _packages/page/resources/lang/en/translations.php create mode 100644 _packages/page/resources/lang/es/translations.php create mode 100644 _packages/page/resources/lang/nb_NO/translations.php create mode 100644 _packages/page/src/Commands/InstallCommand.php create mode 100644 _packages/page/src/Models/Page.php create mode 100644 _packages/page/src/PagePlugin.php create mode 100644 _packages/page/src/PageServiceProvider.php create mode 100644 _packages/page/src/Resources/PageResource.php create mode 100644 _packages/page/src/Resources/PageResource/Pages/ListPage.php create mode 100644 _packages/page/src/Resources/PageResource/Widgets/PageWidgets.php create mode 100644 _packages/user/.gitignore create mode 100644 _packages/user/CHANGELOG.md create mode 100644 _packages/user/LICENSE.md create mode 100644 _packages/user/README.md create mode 100644 _packages/user/SECURITY.md create mode 100644 _packages/user/composer.json create mode 100644 _packages/user/config/user.php create mode 100644 _packages/user/database/migrations/create_user_table.php.stub create mode 100644 _packages/user/resources/lang/de/translations.php create mode 100644 _packages/user/resources/lang/en/translations.php create mode 100644 _packages/user/resources/lang/es/translations.php create mode 100644 _packages/user/resources/lang/nb_NO/translations.php create mode 100644 _packages/user/src/Commands/InstallCommand.php create mode 100644 _packages/user/src/Models/User.php create mode 100644 _packages/user/src/Resources/UserResource.php create mode 100644 _packages/user/src/Resources/UserResource/Pages/ListPage.php create mode 100644 _packages/user/src/Resources/UserResource/Widgets/UserWidgets.php create mode 100644 _packages/user/src/UserPlugin.php create mode 100644 _packages/user/src/UserServiceProvider.php create mode 100644 config/blog.php create mode 100644 config/core.php create mode 100644 config/data.php create mode 100644 config/file.php create mode 100644 config/logs.php rename config/{tallui.php => moox.php} (95%) create mode 100644 config/page.php create mode 100644 config/user.php create mode 100644 database/migrations/2023_12_08_153354_create_blog_table.php create mode 100644 database/migrations/2023_12_08_153405_create_core_table.php create mode 100644 database/migrations/2023_12_08_153414_create_data_table.php create mode 100644 database/migrations/2023_12_08_153423_create_file_table.php create mode 100644 database/migrations/2023_12_08_153438_create_logs_table.php create mode 100644 database/migrations/2023_12_08_153446_create_page_table.php create mode 100644 database/migrations/2023_12_08_153454_create_user_table.php diff --git a/README.md b/README.md index 420c6fbcc..583d5044f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Laravel PINT PHP Code Style - PHPStan Level 5 + PHPStan Level 2

diff --git a/_custom/README.md b/_custom/README.md index b3fd8e191..b51568ba3 100644 --- a/_custom/README.md +++ b/_custom/README.md @@ -12,7 +12,7 @@ Laravel PINT PHP Code Style - PHPStan Level 5 + PHPStan Level 2

diff --git a/_other/README.md b/_other/README.md index fc1f4b166..03b5478d9 100644 --- a/_other/README.md +++ b/_other/README.md @@ -12,7 +12,7 @@ Laravel PINT PHP Code Style - PHPStan Level 5 + PHPStan Level 2

@@ -64,7 +64,7 @@ Here is the place to find: -- [art](art/README.md) - the logo, banner images and screenshots -- [builder](builder/README.md) - our package skeleton template or plugin builder -- [satis](satis/README.md) - Satis, the self-hosted private Repo for Moox -- [vscode](vscode/README.md) - our VS Code Extension Pack for TALL-Stack developers +- [art](art/README.md) - the logo, banner images and screenshots +- [builder](builder/README.md) - our package skeleton template or plugin builder +- [satis](satis/README.md) - Satis, the self-hosted private Repo for Moox +- [vscode](vscode/README.md) - our VS Code Extension Pack for TALL-Stack developers diff --git a/_other/art/README.md b/_other/art/README.md index 78a72c41c..8c866ae9b 100644 --- a/_other/art/README.md +++ b/_other/art/README.md @@ -12,7 +12,7 @@ Laravel PINT PHP Code Style - PHPStan Level 5 + PHPStan Level 2

@@ -68,10 +68,10 @@ Here is the place to find our logo, signet, screenshots and banners as well as i Moox is a random word that: -- was a short .org domain I registered 20 years ago -- was a popular set of TYPO3 Extensions about 10 years ago -- sound good combined with techy words, try "Moox Blog" -- can be used like "google", try "let me moox your website" +- was a short .org domain I registered 20 years ago +- was a popular set of TYPO3 Extensions about 10 years ago +- sound good combined with techy words, try "Moox Blog" +- can be used like "google", try "let me moox your website" ## Moox Logo @@ -88,7 +88,6 @@ The banner sizes are 1280 by 640 pixels. Our screenshots should use the Moox Screenshot Mockup. Please take care of not leaking private data. - ## Moox Bot Moox Bot is the identity of our GitHub Bot. There are maybe more things, Moox Bot can do in the future ;-) diff --git a/_packages/README.md b/_packages/README.md index 0c4c99309..7e1b43aa4 100644 --- a/_packages/README.md +++ b/_packages/README.md @@ -12,7 +12,7 @@ Laravel PINT PHP Code Style - PHPStan Level 5 + PHPStan Level 2

diff --git a/_packages/blog/.gitignore b/_packages/blog/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/blog/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/blog/CHANGELOG.md b/_packages/blog/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/blog/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/blog/LICENSE.md b/_packages/blog/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/blog/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/blog/README.md b/_packages/blog/README.md index eddd276f7..e624373c6 100644 --- a/_packages/blog/README.md +++ b/_packages/blog/README.md @@ -1,3 +1,52 @@ -# wip +![Moox Blog](https://github.com/mooxphp/moox/raw/main/_other/art/banner/blog.jpg) -- This is only to trigger a test for mooxbot +# Moox Blog + +This is my package blog + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/blog +php artisan mooxblog:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package blog + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxblog:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="blog-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="blog-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/blog/SECURITY.md b/_packages/blog/SECURITY.md new file mode 100644 index 000000000..8bdbcfc3b --- /dev/null +++ b/_packages/blog/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox Blog` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/blog/composer.json b/_packages/blog/composer.json new file mode 100644 index 000000000..af3f62920 --- /dev/null +++ b/_packages/blog/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/blog", + "description": "This is my package blog", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\Blog\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\Blog\\BlogServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/core/config/builder.php b/_packages/blog/config/blog.php similarity index 57% rename from _packages/core/config/builder.php rename to _packages/blog/config/blog.php index a045a0360..96528bbce 100644 --- a/_packages/core/config/builder.php +++ b/_packages/blog/config/blog.php @@ -2,15 +2,15 @@ return [ 'resources' => [ - 'builder' => [ + 'blog' => [ 'enabled' => true, - 'label' => 'Builder', - 'plural_label' => 'Builders', - 'navigation_group' => 'Builder Group', + 'label' => 'Blog', + 'plural_label' => 'Blogs', + 'navigation_group' => 'Blog Group', 'navigation_icon' => 'heroicon-o-play', 'navigation_sort' => 1, 'navigation_count_badge' => true, - 'resource' => Moox\Builder\Resources\BuilderResource::class, + 'resource' => Moox\Blog\Resources\BlogResource::class, ], ], 'pruning' => [ diff --git a/_packages/core/database/migrations/create_builder_table.php.stub b/_packages/blog/database/migrations/create_blog_table.php.stub similarity index 86% rename from _packages/core/database/migrations/create_builder_table.php.stub rename to _packages/blog/database/migrations/create_blog_table.php.stub index 1ed5ad13b..db6760e82 100644 --- a/_packages/core/database/migrations/create_builder_table.php.stub +++ b/_packages/blog/database/migrations/create_blog_table.php.stub @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('builder', function (Blueprint $table) { + Schema::create('blog', function (Blueprint $table) { $table->id(); $table->string('name')->nullable(); $table->timestamp('started_at')->nullable()->index(); @@ -27,6 +27,6 @@ return new class extends Migration public function down(): void { - Schema::dropIfExists('builder'); + Schema::dropIfExists('blog'); } }; diff --git a/_packages/blog/resources/lang/de/translations.php b/_packages/blog/resources/lang/de/translations.php new file mode 100644 index 000000000..1a461b95b --- /dev/null +++ b/_packages/blog/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'Blog', + 'title' => 'Blog', + 'navigation_label' => 'Blog', + 'navigation_group' => 'Blog Gruppe', + 'totalone' => 'Blog Eins', + 'totaltwo' => 'Blog Zwei', + 'totalthree' => 'Blog Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/blog/resources/lang/en/translations.php b/_packages/blog/resources/lang/en/translations.php new file mode 100644 index 000000000..27fb91539 --- /dev/null +++ b/_packages/blog/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'Blog', + 'title' => 'Blog', + 'navigation_label' => 'Blog', + 'navigation_group' => 'Blog Group', + 'totalone' => 'Blog One', + 'totaltwo' => 'Blog Two', + 'totalthree' => 'Blog Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/blog/resources/lang/es/translations.php b/_packages/blog/resources/lang/es/translations.php new file mode 100644 index 000000000..84f748843 --- /dev/null +++ b/_packages/blog/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'Blog', + 'title' => 'Blog', + 'navigation_label' => 'Blog', + 'navigation_group' => 'Blog Grupo', + 'totalone' => 'Blog Uno', + 'totaltwo' => 'Blog Dos', + 'totalthree' => 'Blog Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/blog/resources/lang/nb_NO/translations.php b/_packages/blog/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/blog/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/core/src/BuilderPlugin.php b/_packages/blog/src/BlogPlugin.php similarity index 83% rename from _packages/core/src/BuilderPlugin.php rename to _packages/blog/src/BlogPlugin.php index 5459c1f01..f8e2cffe3 100644 --- a/_packages/core/src/BuilderPlugin.php +++ b/_packages/blog/src/BlogPlugin.php @@ -1,13 +1,13 @@ resource ?? config('builder.resources.builder.resource'); + return $this->resource ?? config('blog.resources.blog.resource'); } /** @@ -126,7 +126,7 @@ public function resource(string $resource): static */ public function getLabel(): ?string { - return $this->evaluate($this->label) ?? config('builder.resources.builder.label'); + return $this->evaluate($this->label) ?? config('blog.resources.blog.label'); } /** @@ -144,7 +144,7 @@ public function label(string $label): static */ public function getPluralLabel(): ?string { - return $this->evaluate($this->pluralLabel) ?? config('builder.resources.builder.plural_label'); + return $this->evaluate($this->pluralLabel) ?? config('blog.resources.blog.plural_label'); } /** @@ -162,7 +162,7 @@ public function pluralLabel(string $pluralLabel): static */ public function getNavigationGroup(): ?string { - return $this->navigationGroup ?? config('builder.resources.builder.navigation_group'); + return $this->navigationGroup ?? config('blog.resources.blog.navigation_group'); } /** @@ -180,7 +180,7 @@ public function navigationGroup(string $navigationGroup): static */ public function getNavigationIcon(): ?string { - return $this->navigationIcon ?? config('builder.resources.builder.navigation_icon'); + return $this->navigationIcon ?? config('blog.resources.blog.navigation_icon'); } /** @@ -198,7 +198,7 @@ public function navigationIcon(string $navigationIcon): static */ public function getNavigationSort(): ?int { - return $this->navigationSort ?? config('builder.resources.builder.navigation_sort'); + return $this->navigationSort ?? config('blog.resources.blog.navigation_sort'); } /** @@ -216,7 +216,7 @@ public function navigationSort(int $navigationSort): static */ public function getNavigationCountBadge(): ?bool { - return $this->navigationCountBadge ?? config('builder.resources.builder.navigation_count_badge'); + return $this->navigationCountBadge ?? config('blog.resources.blog.navigation_count_badge'); } /** @@ -234,7 +234,7 @@ public function navigationCountBadge(bool $navigationCountBadge = true): static */ public function shouldRegisterNavigation(): bool { - return $this->navigation ?? config('builder.resources.builder.enabled'); + return $this->navigation ?? config('blog.resources.blog.enabled'); } /** @@ -252,6 +252,6 @@ public function enableNavigation(bool $status = true): static */ public function getBreadcrumb(): string { - return __('builder::translations.breadcrumb'); + return __('blog::translations.breadcrumb'); } } diff --git a/_packages/core/src/BuilderServiceProvider.php b/_packages/blog/src/BlogServiceProvider.php similarity index 63% rename from _packages/core/src/BuilderServiceProvider.php rename to _packages/blog/src/BlogServiceProvider.php index a945d8fe2..87586b159 100644 --- a/_packages/core/src/BuilderServiceProvider.php +++ b/_packages/blog/src/BlogServiceProvider.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace Moox\Builder; +namespace Moox\Blog; -use Moox\Builder\Commands\InstallCommand; +use Moox\Blog\Commands\InstallCommand; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; -class BuilderServiceProvider extends PackageServiceProvider +class BlogServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void { $package - ->name('builder') + ->name('blog') ->hasConfigFile() ->hasViews() ->hasTranslations() - ->hasMigration('create_builder_table') + ->hasMigration('create_blog_table') ->hasCommand(InstallCommand::class); } } diff --git a/_packages/blog/src/Commands/InstallCommand.php b/_packages/blog/src/Commands/InstallCommand.php new file mode 100644 index 000000000..f3c3335ac --- /dev/null +++ b/_packages/blog/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing Blog Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'blog-config']); + + $this->comment('Publishing Blog Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'blog-migrations']); + $this->call('migrate'); + $this->info('Blog was installed successfully'); + } +} diff --git a/_packages/core/src/Models/Builder.php b/_packages/blog/src/Models/Blog.php similarity index 76% rename from _packages/core/src/Models/Builder.php rename to _packages/blog/src/Models/Blog.php index 4b8015793..4bf6980f8 100644 --- a/_packages/core/src/Models/Builder.php +++ b/_packages/blog/src/Models/Blog.php @@ -1,12 +1,12 @@ columns([ TextColumn::make('name') - ->label(__('builder::translations.name')) + ->label(__('blog::translations.name')) ->sortable(), TextColumn::make('started_at') - ->label(__('builder::translations.started_at')) + ->label(__('blog::translations.started_at')) ->since() ->sortable(), TextColumn::make('failed') - ->label(__('builder::translations.failed')) + ->label(__('blog::translations.failed')) ->sortable(), ]) ->defaultSort('name', 'desc') @@ -75,23 +75,23 @@ public static function getPages(): array public static function getWidgets(): array { return [ - BuilderWidgets::class, + BlogWidgets::class, ]; } public static function getNavigationBadge(): ?string { - return BuilderPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + return BlogPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; } public static function getModelLabel(): string { - return BuilderPlugin::get()->getLabel(); + return BlogPlugin::get()->getLabel(); } public static function getPluralModelLabel(): string { - return BuilderPlugin::get()->getPluralLabel(); + return BlogPlugin::get()->getPluralLabel(); } public static function getNavigationLabel(): string @@ -101,26 +101,26 @@ public static function getNavigationLabel(): string public static function getNavigationGroup(): ?string { - return BuilderPlugin::get()->getNavigationGroup(); + return BlogPlugin::get()->getNavigationGroup(); } public static function getNavigationSort(): ?int { - return BuilderPlugin::get()->getNavigationSort(); + return BlogPlugin::get()->getNavigationSort(); } public static function getBreadcrumb(): string { - return BuilderPlugin::get()->getBreadcrumb(); + return BlogPlugin::get()->getBreadcrumb(); } public static function shouldRegisterNavigation(): bool { - return BuilderPlugin::get()->shouldRegisterNavigation(); + return BlogPlugin::get()->shouldRegisterNavigation(); } public static function getNavigationIcon(): string { - return BuilderPlugin::get()->getNavigationIcon(); + return BlogPlugin::get()->getNavigationIcon(); } } diff --git a/_packages/core/src/Resources/BuilderResource/Pages/ListPage.php b/_packages/blog/src/Resources/BlogResource/Pages/ListPage.php similarity index 62% rename from _packages/core/src/Resources/BuilderResource/Pages/ListPage.php rename to _packages/blog/src/Resources/BlogResource/Pages/ListPage.php index a01e5681b..c6b992061 100644 --- a/_packages/core/src/Resources/BuilderResource/Pages/ListPage.php +++ b/_packages/blog/src/Resources/BlogResource/Pages/ListPage.php @@ -1,16 +1,16 @@ using(function (array $data, string $model): Builder { + ->using(function (array $data, string $model): Blog { return $model::create($data); }), ]; diff --git a/_packages/core/src/Resources/BuilderResource/Widgets/BuilderWidgets.php b/_packages/blog/src/Resources/BlogResource/Widgets/BlogWidgets.php similarity index 51% rename from _packages/core/src/Resources/BuilderResource/Widgets/BuilderWidgets.php rename to _packages/blog/src/Resources/BlogResource/Widgets/BlogWidgets.php index ef29b0cf0..ab4926628 100644 --- a/_packages/core/src/Resources/BuilderResource/Widgets/BuilderWidgets.php +++ b/_packages/blog/src/Resources/BlogResource/Widgets/BlogWidgets.php @@ -1,13 +1,13 @@ select($aggregationColumns) ->first(); return [ - Stat::make(__('builder::translations.totalone'), $aggregatedInfo->count ?? 0), - Stat::make(__('builder::translations.totaltwo'), $aggregatedInfo->count ?? 0), - Stat::make(__('builder::translations.totalthree'), $aggregatedInfo->count ?? 0), + Stat::make(__('blog::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('blog::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('blog::translations.totalthree'), $aggregatedInfo->count ?? 0), ]; } } diff --git a/_packages/core/README.md b/_packages/core/README.md index 0e1367049..1dfda3e6c 100644 --- a/_packages/core/README.md +++ b/_packages/core/README.md @@ -1,20 +1,16 @@ -![Moox Builder](https://github.com/mooxphp/moox/raw/main/_other/art/banner/builder.jpg) +![Moox Core](https://github.com/mooxphp/moox/raw/main/_other/art/banner/core.jpg) -# Moox Builder +# Moox Core - -This template is used for generating all Moox packages. Press the Template-Button in GitHub, to create your own. - -If you install it, it will completely work without beeing useful. Guaranteed! - +This is my package core ## Quick Installation These two commmands are all you need to install the package: ```bash -composer require moox/builder -php artisan mooxbuilder:install +composer require moox/core +php artisan mooxcore:install ``` Curious what the install command does? See manual installation below. @@ -22,21 +18,21 @@ Curious what the install command does? See manual installation below. ## What does it do? -Here are some things missing, like an overview with screenshots about this package, or simply a link to the package's docs. +This is my package core ## Manual Installation -Instead of using the install-command `php artisan mooxbuilder:install` you are able to install this package manually step by step: +Instead of using the install-command `php artisan mooxcore:install` you are able to install this package manually step by step: ```bash // Publish and run the migrations: -php artisan vendor:publish --tag="builder-migrations" +php artisan vendor:publish --tag="core-migrations" php artisan migrate // Publish the config file with: -php artisan vendor:publish --tag="builder-config" +php artisan vendor:publish --tag="core-config" ``` ## Changelog diff --git a/_packages/core/SECURITY.md b/_packages/core/SECURITY.md index 59cedcb5d..e7bef5427 100644 --- a/_packages/core/SECURITY.md +++ b/_packages/core/SECURITY.md @@ -2,7 +2,7 @@ ## Supported Versions -We maintain the current version of `Moox Builder` actively. +We maintain the current version of `Moox Core` actively. Do not expect security fixes for older versions. diff --git a/_packages/core/build.php b/_packages/core/build.php deleted file mode 100644 index b94b75d87..000000000 --- a/_packages/core/build.php +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env php -.*/s', $content, $contents) ?: $contents - ); -} - -function safeUnlink(string $filename) -{ - if (file_exists($filename) && is_file($filename)) { - unlink($filename); - } -} - -function determineSeparator(string $path): string -{ - return str_replace('/', DIRECTORY_SEPARATOR, $path); -} - -function replaceForWindows(): array -{ - return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ "Builder builder create_builder_table"')); -} - -function replaceForAllOtherOSes(): array -{ - return explode(PHP_EOL, run('grep -E -r -l -i "Builder|builder|create_builder_table" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__))); -} - -function getGitHubApiEndpoint(string $endpoint): ?stdClass -{ - try { - $curl = curl_init("https://api.github.com/{$endpoint}"); - curl_setopt_array($curl, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTPGET => true, - CURLOPT_HTTPHEADER => [ - 'User-Agent: spatie-configure-script/1.0', - ], - ]); - - $response = curl_exec($curl); - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); - - curl_close($curl); - - if ($statusCode === 200) { - return json_decode($response); - } - } catch (Exception $e) { - // ignore - } - - return null; -} - -function searchCommitsForGitHubUsername(): string -{ - $authorName = strtolower(trim(shell_exec('git config user.name'))); - - $committersRaw = shell_exec("git log --author='@users.noreply.github.com' --pretty='%an:%ae' --reverse"); - $committersLines = explode("\n", $committersRaw); - $committers = array_filter(array_map(function ($line) use ($authorName) { - $line = trim($line); - [$name, $email] = explode(':', $line) + [null, null]; - - return [ - 'name' => $name, - 'email' => $email, - 'isMatch' => strtolower($name) === $authorName && ! str_contains($name, '[bot]'), - ]; - }, $committersLines), fn ($item) => $item['isMatch']); - - if (empty($committers)) { - return ''; - } - - $firstCommitter = reset($committers); - - return explode('@', $firstCommitter['email'])[0] ?? ''; -} - -function guessGitHubUsernameUsingCli() -{ - try { - if (preg_match('/ogged in to github\.com as ([a-zA-Z-_]+).+/', shell_exec('gh auth status -h github.com 2>&1'), $matches)) { - return $matches[1]; - } - } catch (Exception $e) { - // ignore - } - - return ''; -} - -function guessGitHubUsername(): string -{ - $username = searchCommitsForGitHubUsername(); - if (! empty($username)) { - return $username; - } - - $username = guessGitHubUsernameUsingCli(); - if (! empty($username)) { - return $username; - } - - // fall back to using the username from the git remote - $remoteUrl = shell_exec('git config remote.origin.url'); - $remoteUrlParts = explode('/', str_replace(':', '/', trim($remoteUrl))); - - return $remoteUrlParts[1] ?? ''; -} - -function guessGitHubVendorInfo($authorName, $username): array -{ - $remoteUrl = shell_exec('git config remote.origin.url'); - $remoteUrlParts = explode('/', str_replace(':', '/', trim($remoteUrl))); - - $response = getGitHubApiEndpoint("orgs/{$remoteUrlParts[1]}"); - - if ($response === null) { - return [$authorName, $username]; - } - - return [$response->name ?? $authorName, $response->login ?? $username]; -} - -$authorName = ask('Author name', 'Moox Developer'); - -$authorEmail = ask('Author email', 'dev@moox.org'); - -$currentDirectory = getcwd(); -$folderName = basename($currentDirectory); - -$packageName = ask('Package name', $folderName); -$packageSlug = slugify($packageName); -$packageSlugWithoutPrefix = remove_prefix('laravel-', $packageSlug); - -$className = title_case($packageName); -$className = ask('Class name', $className); -$variableName = lcfirst($className); -$description = ask('Package description', "This is my package {$packageSlug}"); - -writeln('------'); -writeln("Author : {$authorName}"); -writeln("Author Email : {$authorEmail}"); -writeln("Namespace : Moox\\{$className}"); -writeln("Packagename : moox\\{$packageSlug}"); -writeln("Class name : {$className}Plugin"); -writeln('------'); - -writeln('This script will replace the above values in all relevant files in the project directory.'); - -if (! confirm('Modify files?', true)) { - exit(1); -} - -$files = (str_starts_with(strtoupper(PHP_OS), 'WIN') ? replaceForWindows() : replaceForAllOtherOSes()); - -foreach ($files as $file) { - replace_in_file($file, [ - 'Moox Developer' => $authorName, - 'dev@moox.org' => $authorEmail, - 'Builder' => $className, - 'builder' => $packageSlug, - 'create_builder_table' => title_snake($packageSlug), - 'This template is used for generating all Moox packages.' => $description, - 'Here are some things missing, like an overview with screenshots about this package, or simply a link to the package\'s docs.' => $description, - ]); - - match (true) { - str_contains($file, determineSeparator('src/BuilderPlugin.php')) => rename($file, determineSeparator('./src/'.$className.'Plugin.php')), - str_contains($file, determineSeparator('src/BuilderServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')), - str_contains($file, determineSeparator('src/Resources/BuilderResource.php')) => rename($file, determineSeparator('./src/Resources/'.$className.'Resource.php')), - str_contains($file, determineSeparator('src/Models/Builder.php')) => rename($file, determineSeparator('./src/Models/'.$className.'.php')), - str_contains($file, determineSeparator('src/Resources/BuilderResource/Widgets/BuilderWidgets.php')) => rename($file, determineSeparator('./src/Resources/BuilderResource/Widgets/'.$className.'Widgets.php')), - str_contains($file, determineSeparator('database/migrations/create_builder_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.title_snake($packageSlugWithoutPrefix).'_table.php.stub')), - str_contains($file, determineSeparator('config/builder.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')), - str_contains($file, 'README.md') => replace_readme_paragraphs($file, $description), - default => [], - }; -} -rename(determineSeparator('src/Resources/BuilderResource'), determineSeparator('./src/Resources/'.$className.'Resource')); - -confirm('Execute `composer install` and run tests?') && run('composer install && composer test'); - -confirm('Let this script delete itself?', true) && unlink(__FILE__); diff --git a/_packages/core/composer.json b/_packages/core/composer.json index b432b8f58..c216b3e69 100644 --- a/_packages/core/composer.json +++ b/_packages/core/composer.json @@ -1,6 +1,6 @@ { - "name": "moox/builder", - "description": "This template is used for generating all Moox packages.", + "name": "moox/core", + "description": "This is my package core", "keywords": [ "Laravel", "Filament", @@ -22,13 +22,13 @@ }, "autoload": { "psr-4": { - "Moox\\Builder\\": "src" + "Moox\\Core\\": "src" } }, "extra": { "laravel": { "providers": [ - "Moox\\Builder\\BuilderServiceProvider" + "Moox\\Core\\CoreServiceProvider" ] } }, diff --git a/_packages/core/config/core.php b/_packages/core/config/core.php new file mode 100644 index 000000000..346009fb9 --- /dev/null +++ b/_packages/core/config/core.php @@ -0,0 +1,20 @@ + [ + 'core' => [ + 'enabled' => true, + 'label' => 'Core', + 'plural_label' => 'Cores', + 'navigation_group' => 'Core Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Core\Resources\CoreResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/core/database/migrations/create_core_table.php.stub b/_packages/core/database/migrations/create_core_table.php.stub new file mode 100644 index 000000000..36142f054 --- /dev/null +++ b/_packages/core/database/migrations/create_core_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('core'); + } +}; diff --git a/_packages/core/resources/lang/de/translations.php b/_packages/core/resources/lang/de/translations.php index 5f60ef223..abadbe9a2 100644 --- a/_packages/core/resources/lang/de/translations.php +++ b/_packages/core/resources/lang/de/translations.php @@ -1,13 +1,13 @@ 'Builder', - 'title' => 'Builder', - 'navigation_label' => 'Builder', - 'navigation_group' => 'Builder Gruppe', - 'totalone' => 'Builder Eins', - 'totaltwo' => 'Builder Zwei', - 'totalthree' => 'Builder Drei', + 'breadcrumb' => 'Core', + 'title' => 'Core', + 'navigation_label' => 'Core', + 'navigation_group' => 'Core Gruppe', + 'totalone' => 'Core Eins', + 'totaltwo' => 'Core Zwei', + 'totalthree' => 'Core Drei', 'name' => 'Name', 'started_at' => 'Gestartet', 'failed' => 'failed', diff --git a/_packages/core/resources/lang/en/translations.php b/_packages/core/resources/lang/en/translations.php index a1b882ed3..3727bb13a 100644 --- a/_packages/core/resources/lang/en/translations.php +++ b/_packages/core/resources/lang/en/translations.php @@ -1,13 +1,13 @@ 'Builder', - 'title' => 'Builder', - 'navigation_label' => 'Builder', - 'navigation_group' => 'Builder Group', - 'totalone' => 'Builder One', - 'totaltwo' => 'Builder Two', - 'totalthree' => 'Builder Three', + 'breadcrumb' => 'Core', + 'title' => 'Core', + 'navigation_label' => 'Core', + 'navigation_group' => 'Core Group', + 'totalone' => 'Core One', + 'totaltwo' => 'Core Two', + 'totalthree' => 'Core Three', 'name' => 'Name', 'started_at' => 'Started at', 'failed' => 'failed', diff --git a/_packages/core/resources/lang/es/translations.php b/_packages/core/resources/lang/es/translations.php index 60977e8ae..f47eec142 100644 --- a/_packages/core/resources/lang/es/translations.php +++ b/_packages/core/resources/lang/es/translations.php @@ -1,13 +1,13 @@ 'Builder', - 'title' => 'Builder', - 'navigation_label' => 'Builder', - 'navigation_group' => 'Builder Grupo', - 'totalone' => 'Builder Uno', - 'totaltwo' => 'Builder Dos', - 'totalthree' => 'Builder Trés', + 'breadcrumb' => 'Core', + 'title' => 'Core', + 'navigation_label' => 'Core', + 'navigation_group' => 'Core Grupo', + 'totalone' => 'Core Uno', + 'totaltwo' => 'Core Dos', + 'totalthree' => 'Core Trés', 'name' => 'Nombre', 'started_at' => 'Empezó a las', 'failed' => 'failed', diff --git a/_packages/core/src/Commands/InstallCommand.php b/_packages/core/src/Commands/InstallCommand.php index efa523840..b6ca2583c 100644 --- a/_packages/core/src/Commands/InstallCommand.php +++ b/_packages/core/src/Commands/InstallCommand.php @@ -1,6 +1,6 @@ comment('Publishing Builder Configuration...'); - $this->callSilent('vendor:publish', ['--tag' => 'builder-config']); + $this->comment('Publishing Core Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'core-config']); - $this->comment('Publishing Builder Migrations...'); - $this->callSilent('vendor:publish', ['--tag' => 'builder-migrations']); + $this->comment('Publishing Core Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'core-migrations']); $this->call('migrate'); - $this->info('Builder was installed successfully'); + $this->info('Core was installed successfully'); } } diff --git a/_packages/core/src/CorePlugin.php b/_packages/core/src/CorePlugin.php new file mode 100644 index 000000000..1d6bc1de3 --- /dev/null +++ b/_packages/core/src/CorePlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('core.resources.core.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('core.resources.core.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('core.resources.core.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('core.resources.core.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('core.resources.core.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('core.resources.core.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('core.resources.core.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('core.resources.core.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('core::translations.breadcrumb'); + } +} diff --git a/_packages/core/src/CoreServiceProvider.php b/_packages/core/src/CoreServiceProvider.php new file mode 100644 index 000000000..551d623ba --- /dev/null +++ b/_packages/core/src/CoreServiceProvider.php @@ -0,0 +1,23 @@ +name('core') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_core_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/_packages/core/src/Models/Core.php b/_packages/core/src/Models/Core.php new file mode 100644 index 000000000..876ab32f2 --- /dev/null +++ b/_packages/core/src/Models/Core.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/core/src/Resources/CoreResource.php b/_packages/core/src/Resources/CoreResource.php new file mode 100644 index 000000000..b0bc2b48b --- /dev/null +++ b/_packages/core/src/Resources/CoreResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('core::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('core::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('core::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + CoreWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return CorePlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return CorePlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return CorePlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return CorePlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return CorePlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return CorePlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return CorePlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return CorePlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/core/src/Resources/CoreResource/Pages/ListPage.php b/_packages/core/src/Resources/CoreResource/Pages/ListPage.php new file mode 100644 index 000000000..1dda3192f --- /dev/null +++ b/_packages/core/src/Resources/CoreResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): Core { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/core/src/Resources/CoreResource/Widgets/CoreWidgets.php b/_packages/core/src/Resources/CoreResource/Widgets/CoreWidgets.php new file mode 100644 index 000000000..996b8db9c --- /dev/null +++ b/_packages/core/src/Resources/CoreResource/Widgets/CoreWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('core::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('core::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('core::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/data/.gitignore b/_packages/data/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/data/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/data/CHANGELOG.md b/_packages/data/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/data/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/data/LICENSE.md b/_packages/data/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/data/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/data/README.md b/_packages/data/README.md new file mode 100644 index 000000000..3e7214d6a --- /dev/null +++ b/_packages/data/README.md @@ -0,0 +1,52 @@ +![Moox Data](https://github.com/mooxphp/moox/raw/main/_other/art/banner/data.jpg) + +# Moox Data + +This is my package data + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/data +php artisan mooxdata:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package data + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxdata:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="data-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="data-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/data/SECURITY.md b/_packages/data/SECURITY.md new file mode 100644 index 000000000..2b9a40d34 --- /dev/null +++ b/_packages/data/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox Data` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/data/composer.json b/_packages/data/composer.json new file mode 100644 index 000000000..7717a269a --- /dev/null +++ b/_packages/data/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/data", + "description": "This is my package data", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\Data\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\Data\\DataServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/data/config/data.php b/_packages/data/config/data.php new file mode 100644 index 000000000..521e04d0c --- /dev/null +++ b/_packages/data/config/data.php @@ -0,0 +1,20 @@ + [ + 'data' => [ + 'enabled' => true, + 'label' => 'Data', + 'plural_label' => 'Datas', + 'navigation_group' => 'Data Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Data\Resources\DataResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/data/database/migrations/create_data_table.php.stub b/_packages/data/database/migrations/create_data_table.php.stub new file mode 100644 index 000000000..6a48b02aa --- /dev/null +++ b/_packages/data/database/migrations/create_data_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('data'); + } +}; diff --git a/_packages/data/resources/lang/de/translations.php b/_packages/data/resources/lang/de/translations.php new file mode 100644 index 000000000..3a590c476 --- /dev/null +++ b/_packages/data/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'Data', + 'title' => 'Data', + 'navigation_label' => 'Data', + 'navigation_group' => 'Data Gruppe', + 'totalone' => 'Data Eins', + 'totaltwo' => 'Data Zwei', + 'totalthree' => 'Data Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/data/resources/lang/en/translations.php b/_packages/data/resources/lang/en/translations.php new file mode 100644 index 000000000..c676fad6d --- /dev/null +++ b/_packages/data/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'Data', + 'title' => 'Data', + 'navigation_label' => 'Data', + 'navigation_group' => 'Data Group', + 'totalone' => 'Data One', + 'totaltwo' => 'Data Two', + 'totalthree' => 'Data Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/data/resources/lang/es/translations.php b/_packages/data/resources/lang/es/translations.php new file mode 100644 index 000000000..d765c4956 --- /dev/null +++ b/_packages/data/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'Data', + 'title' => 'Data', + 'navigation_label' => 'Data', + 'navigation_group' => 'Data Grupo', + 'totalone' => 'Data Uno', + 'totaltwo' => 'Data Dos', + 'totalthree' => 'Data Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/data/resources/lang/nb_NO/translations.php b/_packages/data/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/data/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/data/src/Commands/InstallCommand.php b/_packages/data/src/Commands/InstallCommand.php new file mode 100644 index 000000000..32a216264 --- /dev/null +++ b/_packages/data/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing Data Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'data-config']); + + $this->comment('Publishing Data Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'data-migrations']); + $this->call('migrate'); + $this->info('Data was installed successfully'); + } +} diff --git a/_packages/data/src/DataPlugin.php b/_packages/data/src/DataPlugin.php new file mode 100644 index 000000000..970fb375e --- /dev/null +++ b/_packages/data/src/DataPlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('data.resources.data.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('data.resources.data.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('data.resources.data.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('data.resources.data.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('data.resources.data.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('data.resources.data.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('data.resources.data.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('data.resources.data.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('data::translations.breadcrumb'); + } +} diff --git a/_packages/data/src/DataServiceProvider.php b/_packages/data/src/DataServiceProvider.php new file mode 100644 index 000000000..ebcee37e7 --- /dev/null +++ b/_packages/data/src/DataServiceProvider.php @@ -0,0 +1,23 @@ +name('data') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_data_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/_packages/data/src/Models/Data.php b/_packages/data/src/Models/Data.php new file mode 100644 index 000000000..d9fd2f718 --- /dev/null +++ b/_packages/data/src/Models/Data.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/data/src/Resources/DataResource.php b/_packages/data/src/Resources/DataResource.php new file mode 100644 index 000000000..8b1d52ddd --- /dev/null +++ b/_packages/data/src/Resources/DataResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('data::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('data::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('data::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + DataWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return DataPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return DataPlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return DataPlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return DataPlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return DataPlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return DataPlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return DataPlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return DataPlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/data/src/Resources/DataResource/Pages/ListPage.php b/_packages/data/src/Resources/DataResource/Pages/ListPage.php new file mode 100644 index 000000000..c825bd40f --- /dev/null +++ b/_packages/data/src/Resources/DataResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): Data { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/data/src/Resources/DataResource/Widgets/DataWidgets.php b/_packages/data/src/Resources/DataResource/Widgets/DataWidgets.php new file mode 100644 index 000000000..7780f2a3c --- /dev/null +++ b/_packages/data/src/Resources/DataResource/Widgets/DataWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('data::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('data::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('data::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/file/.gitignore b/_packages/file/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/file/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/file/CHANGELOG.md b/_packages/file/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/file/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/file/LICENSE.md b/_packages/file/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/file/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/file/README.md b/_packages/file/README.md new file mode 100644 index 000000000..fbc70bcd7 --- /dev/null +++ b/_packages/file/README.md @@ -0,0 +1,52 @@ +![Moox File](https://github.com/mooxphp/moox/raw/main/_other/art/banner/file.jpg) + +# Moox File + +This is my package file + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/file +php artisan mooxfile:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package file + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxfile:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="file-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="file-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/file/SECURITY.md b/_packages/file/SECURITY.md new file mode 100644 index 000000000..34236f4e7 --- /dev/null +++ b/_packages/file/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox File` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/file/composer.json b/_packages/file/composer.json new file mode 100644 index 000000000..d66f9abe9 --- /dev/null +++ b/_packages/file/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/file", + "description": "This is my package file", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\File\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\File\\FileServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/file/config/file.php b/_packages/file/config/file.php new file mode 100644 index 000000000..f8885cc12 --- /dev/null +++ b/_packages/file/config/file.php @@ -0,0 +1,20 @@ + [ + 'file' => [ + 'enabled' => true, + 'label' => 'File', + 'plural_label' => 'Files', + 'navigation_group' => 'File Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\File\Resources\FileResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/file/database/migrations/create_file_table.php.stub b/_packages/file/database/migrations/create_file_table.php.stub new file mode 100644 index 000000000..d67bae4bf --- /dev/null +++ b/_packages/file/database/migrations/create_file_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('file'); + } +}; diff --git a/_packages/file/resources/lang/de/translations.php b/_packages/file/resources/lang/de/translations.php new file mode 100644 index 000000000..b9d5740f9 --- /dev/null +++ b/_packages/file/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'File', + 'title' => 'File', + 'navigation_label' => 'File', + 'navigation_group' => 'File Gruppe', + 'totalone' => 'File Eins', + 'totaltwo' => 'File Zwei', + 'totalthree' => 'File Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/file/resources/lang/en/translations.php b/_packages/file/resources/lang/en/translations.php new file mode 100644 index 000000000..f84d79dba --- /dev/null +++ b/_packages/file/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'File', + 'title' => 'File', + 'navigation_label' => 'File', + 'navigation_group' => 'File Group', + 'totalone' => 'File One', + 'totaltwo' => 'File Two', + 'totalthree' => 'File Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/file/resources/lang/es/translations.php b/_packages/file/resources/lang/es/translations.php new file mode 100644 index 000000000..a18a56e13 --- /dev/null +++ b/_packages/file/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'File', + 'title' => 'File', + 'navigation_label' => 'File', + 'navigation_group' => 'File Grupo', + 'totalone' => 'File Uno', + 'totaltwo' => 'File Dos', + 'totalthree' => 'File Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/file/resources/lang/nb_NO/translations.php b/_packages/file/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/file/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/file/src/Commands/InstallCommand.php b/_packages/file/src/Commands/InstallCommand.php new file mode 100644 index 000000000..505866dc3 --- /dev/null +++ b/_packages/file/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing File Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'file-config']); + + $this->comment('Publishing File Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'file-migrations']); + $this->call('migrate'); + $this->info('File was installed successfully'); + } +} diff --git a/_packages/file/src/FilePlugin.php b/_packages/file/src/FilePlugin.php new file mode 100644 index 000000000..a058d5591 --- /dev/null +++ b/_packages/file/src/FilePlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('file.resources.file.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('file.resources.file.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('file.resources.file.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('file.resources.file.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('file.resources.file.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('file.resources.file.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('file.resources.file.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('file.resources.file.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('file::translations.breadcrumb'); + } +} diff --git a/_packages/file/src/FileServiceProvider.php b/_packages/file/src/FileServiceProvider.php new file mode 100644 index 000000000..64c340006 --- /dev/null +++ b/_packages/file/src/FileServiceProvider.php @@ -0,0 +1,23 @@ +name('file') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_file_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/_packages/file/src/Models/File.php b/_packages/file/src/Models/File.php new file mode 100644 index 000000000..22b428f18 --- /dev/null +++ b/_packages/file/src/Models/File.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/file/src/Resources/FileResource.php b/_packages/file/src/Resources/FileResource.php new file mode 100644 index 000000000..070d72f48 --- /dev/null +++ b/_packages/file/src/Resources/FileResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('file::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('file::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('file::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + FileWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return FilePlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return FilePlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return FilePlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return FilePlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return FilePlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return FilePlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return FilePlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return FilePlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/file/src/Resources/FileResource/Pages/ListPage.php b/_packages/file/src/Resources/FileResource/Pages/ListPage.php new file mode 100644 index 000000000..47c92defe --- /dev/null +++ b/_packages/file/src/Resources/FileResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): File { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/file/src/Resources/FileResource/Widgets/FileWidgets.php b/_packages/file/src/Resources/FileResource/Widgets/FileWidgets.php new file mode 100644 index 000000000..ce7fe9106 --- /dev/null +++ b/_packages/file/src/Resources/FileResource/Widgets/FileWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('file::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('file::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('file::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/jobs/README.md b/_packages/jobs/README.md index f8d8c09e9..f63b3f1ec 100644 --- a/_packages/jobs/README.md +++ b/_packages/jobs/README.md @@ -97,7 +97,7 @@ return [ 'navigation_icon' => 'heroicon-o-pause', 'navigation_sort' => 2, 'navigation_count_badge' => true, - 'resource' => Moox\Jobs\Resources\WaitingJobsResource::class, + 'resource' => Moox\Jobs\Resources\JobsWaitingResource::class, ], 'failed_jobs' => [ 'enabled' => true, @@ -107,7 +107,7 @@ return [ 'navigation_icon' => 'heroicon-o-exclamation-triangle', 'navigation_sort' => 3, 'navigation_count_badge' => true, - 'resource' => Moox\Jobs\Resources\FailedJobsResource::class, + 'resource' => Moox\Jobs\Resources\JobsFailedResource::class, ], 'job_batches' => [ 'enabled' => true, diff --git a/_packages/jobs/config/jobs.php b/_packages/jobs/config/jobs.php index c8b7cc1e0..baae5d14c 100644 --- a/_packages/jobs/config/jobs.php +++ b/_packages/jobs/config/jobs.php @@ -20,7 +20,7 @@ 'navigation_icon' => 'heroicon-o-pause', 'navigation_sort' => 2, 'navigation_count_badge' => true, - 'resource' => Moox\Jobs\Resources\WaitingJobsResource::class, + 'resource' => Moox\Jobs\Resources\JobsWaitingResource::class, ], 'failed_jobs' => [ 'enabled' => true, @@ -30,7 +30,7 @@ 'navigation_icon' => 'heroicon-o-exclamation-triangle', 'navigation_sort' => 3, 'navigation_count_badge' => true, - 'resource' => Moox\Jobs\Resources\FailedJobsResource::class, + 'resource' => Moox\Jobs\Resources\JobsFailedResource::class, ], 'job_batches' => [ 'enabled' => true, diff --git a/_packages/jobs/resources/lang/de/translations.php b/_packages/jobs/resources/lang/de/translations.php index 725d09399..7e0f01008 100644 --- a/_packages/jobs/resources/lang/de/translations.php +++ b/_packages/jobs/resources/lang/de/translations.php @@ -20,4 +20,5 @@ 'progress' => 'Fortschritt', 'started_at' => 'Gestartet am', 'created_at' => 'Erstellt am', + 'reserved_at' => 'Reserviert am', ]; diff --git a/_packages/jobs/resources/lang/en/translations.php b/_packages/jobs/resources/lang/en/translations.php index 7a77d1e49..8cd765308 100644 --- a/_packages/jobs/resources/lang/en/translations.php +++ b/_packages/jobs/resources/lang/en/translations.php @@ -20,4 +20,5 @@ 'progress' => 'Progress', 'started_at' => 'Started at', 'created_at' => 'Created at', + 'reserved_at' => 'Reserved at', ]; diff --git a/_packages/jobs/resources/lang/es/translations.php b/_packages/jobs/resources/lang/es/translations.php index b53ee5a30..7c0fd7901 100644 --- a/_packages/jobs/resources/lang/es/translations.php +++ b/_packages/jobs/resources/lang/es/translations.php @@ -16,4 +16,6 @@ 'queue' => 'Cola', 'progress' => 'Progreso', 'started_at' => 'Iniciado a las', + 'created_at' => 'Creado a las', + 'reserved_at' => 'Reservado a las', ]; diff --git a/_packages/jobs/resources/lang/fr/translations.php b/_packages/jobs/resources/lang/fr/translations.php index 18b1ea8fb..c89e23240 100644 --- a/_packages/jobs/resources/lang/fr/translations.php +++ b/_packages/jobs/resources/lang/fr/translations.php @@ -16,4 +16,6 @@ 'queue' => 'File', 'progress' => 'Progression', 'started_at' => 'Débuté à', + 'created_at' => 'Créé à', + 'reserved_at' => 'Réservé à', ]; diff --git a/_packages/jobs/src/Models/Job.php b/_packages/jobs/src/Models/Job.php index 77b921fb4..3883e8e07 100644 --- a/_packages/jobs/src/Models/Job.php +++ b/_packages/jobs/src/Models/Job.php @@ -13,11 +13,6 @@ class Job extends Model 'reserved_at', ]; - /* - *-------------------------------------------------------------------------- - * Mutators - *-------------------------------------------------------------------------- - */ public function status(): Attribute { return Attribute::make( @@ -31,12 +26,6 @@ public function status(): Attribute ); } - /* - *-------------------------------------------------------------------------- - * Methods - *-------------------------------------------------------------------------- - */ - public function getDisplayNameAttribute() { $payload = json_decode($this->attributes['payload'], true); diff --git a/_packages/jobs/src/Models/JobManager.php b/_packages/jobs/src/Models/JobManager.php index 042ff5cf9..0d994fe3a 100644 --- a/_packages/jobs/src/Models/JobManager.php +++ b/_packages/jobs/src/Models/JobManager.php @@ -33,11 +33,6 @@ class JobManager extends Model 'finished_at' => 'datetime', ]; - /* - *-------------------------------------------------------------------------- - * Mutators - *-------------------------------------------------------------------------- - */ public function status(): Attribute { return Attribute::make( @@ -51,12 +46,6 @@ public function status(): Attribute ); } - /* - *-------------------------------------------------------------------------- - * Methods - *-------------------------------------------------------------------------- - */ - public static function getJobId(JobContract $job): string|int { if ($jobId = $job->getJobId()) { @@ -66,9 +55,6 @@ public static function getJobId(JobContract $job): string|int return Hash::make($job->getRawBody()); } - /** - * check if the job is finished. - */ public function isFinished(): bool { if ($this->hasFailed()) { @@ -78,17 +64,11 @@ public function isFinished(): bool return $this->finished_at !== null; } - /** - * Check if the job has failed. - */ public function hasFailed(): bool { return $this->failed; } - /** - * check if the job has succeeded. - */ public function hasSucceeded(): bool { if (! $this->isFinished()) { @@ -99,8 +79,6 @@ public function hasSucceeded(): bool } /** - * Get the prunable model query. - * * @return \Illuminate\Database\Eloquent\Builder */ public function prunable() @@ -109,6 +87,6 @@ public function prunable() return static::where('created_at', '<=', now()->subDays(config('jobs.pruning.retention_days'))); } - return false; + return static::query(); } } diff --git a/_packages/jobs/src/Resources/FailedJobsResource.php b/_packages/jobs/src/Resources/JobsFailedResource.php similarity index 98% rename from _packages/jobs/src/Resources/FailedJobsResource.php rename to _packages/jobs/src/Resources/JobsFailedResource.php index dabd4bf3e..c61336520 100644 --- a/_packages/jobs/src/Resources/FailedJobsResource.php +++ b/_packages/jobs/src/Resources/JobsFailedResource.php @@ -19,9 +19,9 @@ use InvadersXX\FilamentJsoneditor\Forms\JSONEditor; use Moox\Jobs\JobsFailedPlugin; use Moox\Jobs\Models\FailedJob; -use Moox\Jobs\Resources\FailedJobsResource\Pages\ListFailedJobs; +use Moox\Jobs\Resources\JobsFailedResource\Pages\ListFailedJobs; -class FailedJobsResource extends Resource +class JobsFailedResource extends Resource { protected static ?string $model = FailedJob::class; diff --git a/_packages/jobs/src/Resources/FailedJobsResource/Pages/ListFailedJobs.php b/_packages/jobs/src/Resources/JobsFailedResource/Pages/ListFailedJobs.php similarity index 88% rename from _packages/jobs/src/Resources/FailedJobsResource/Pages/ListFailedJobs.php rename to _packages/jobs/src/Resources/JobsFailedResource/Pages/ListFailedJobs.php index dee2a5950..e5d8d06b7 100644 --- a/_packages/jobs/src/Resources/FailedJobsResource/Pages/ListFailedJobs.php +++ b/_packages/jobs/src/Resources/JobsFailedResource/Pages/ListFailedJobs.php @@ -1,17 +1,17 @@ select($aggregationColumns) ->first(); + if ($aggregatedInfo) { + $averageTime = property_exists($aggregatedInfo, 'average_time_elapsed') ? ceil((float) $aggregatedInfo->average_time_elapsed).'s' : '0'; + $totalTime = property_exists($aggregatedInfo, 'total_time_elapsed') ? $this->formatSeconds($aggregatedInfo->total_time_elapsed).'s' : '0'; + } else { + $averageTime = '0'; + $totalTime = '0'; + } + return [ Stat::make(__('jobs::translations.total_jobs'), $aggregatedInfo->count ?? 0), - Stat::make(__('jobs::translations.execution_time'), ($this->formatSeconds($aggregatedInfo->total_time_elapsed ?? 0) ?? '0 s')), - Stat::make(__('jobs::translations.average_time'), ceil((float) $aggregatedInfo->average_time_elapsed).'s' ?? 0), + Stat::make(__('jobs::translations.execution_time'), $totalTime), + Stat::make(__('jobs::translations.average_time'), $averageTime), ]; + } } diff --git a/_packages/jobs/src/Resources/WaitingJobsResource.php b/_packages/jobs/src/Resources/JobsWaitingResource.php similarity index 94% rename from _packages/jobs/src/Resources/WaitingJobsResource.php rename to _packages/jobs/src/Resources/JobsWaitingResource.php index 2323cbe8d..6b0f93eb4 100644 --- a/_packages/jobs/src/Resources/WaitingJobsResource.php +++ b/_packages/jobs/src/Resources/JobsWaitingResource.php @@ -14,10 +14,10 @@ use Illuminate\Support\Str; use Moox\Jobs\JobsWaitingPlugin; use Moox\Jobs\Models\Job; -use Moox\Jobs\Resources\WaitingJobsResource\Pages\ListJobsWaiting; -use Moox\Jobs\Resources\WaitingJobsResource\Widgets\JobsWaitingOverview; +use Moox\Jobs\Resources\JobsWaitingResource\Pages\ListJobsWaiting; +use Moox\Jobs\Resources\JobsWaitingResource\Widgets\JobsWaitingOverview; -class WaitingJobsResource extends Resource +class JobsWaitingResource extends Resource { protected static ?string $model = Job::class; @@ -67,7 +67,7 @@ public static function table(Table $table): Table ->label(__('jobs::translations.attempts')) ->sortable(), TextColumn::make('reserved_at') - ->label(__('jobs::translations.created_at')) + ->label(__('jobs::translations.reserved_at')) ->since() ->sortable(), TextColumn::make('created_at') diff --git a/_packages/jobs/src/Resources/WaitingJobsResource/Pages/ListJobsWaiting.php b/_packages/jobs/src/Resources/JobsWaitingResource/Pages/ListJobsWaiting.php similarity index 63% rename from _packages/jobs/src/Resources/WaitingJobsResource/Pages/ListJobsWaiting.php rename to _packages/jobs/src/Resources/JobsWaitingResource/Pages/ListJobsWaiting.php index e0203490c..a6f34aa66 100644 --- a/_packages/jobs/src/Resources/WaitingJobsResource/Pages/ListJobsWaiting.php +++ b/_packages/jobs/src/Resources/JobsWaitingResource/Pages/ListJobsWaiting.php @@ -1,14 +1,14 @@ select($aggregationColumns) ->first(); + if ($aggregatedInfo) { + $averageTime = property_exists($aggregatedInfo, 'average_time_elapsed') ? ceil((float) $aggregatedInfo->average_time_elapsed).'s' : '0'; + $totalTime = property_exists($aggregatedInfo, 'total_time_elapsed') ? $this->formatSeconds($aggregatedInfo->total_time_elapsed).'s' : '0'; + } else { + $averageTime = '0'; + $totalTime = '0'; + } + return [ Stat::make(__('jobs::translations.waiting_jobs'), $jobsWaiting->count ?? 0), - Stat::make(__('jobs::translations.execution_time'), ($this->formatSeconds($aggregatedInfo->total_time_elapsed) ?? '0 s')), - Stat::make(__('jobs::translations.average_time'), ceil((float) $aggregatedInfo->average_time_elapsed).'s' ?? 0), + Stat::make(__('jobs::translations.execution_time'), $totalTime), + Stat::make(__('jobs::translations.average_time'), $averageTime), ]; } } diff --git a/_packages/logs/.gitignore b/_packages/logs/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/logs/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/logs/CHANGELOG.md b/_packages/logs/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/logs/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/logs/LICENSE.md b/_packages/logs/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/logs/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/logs/README.md b/_packages/logs/README.md new file mode 100644 index 000000000..4231a316c --- /dev/null +++ b/_packages/logs/README.md @@ -0,0 +1,52 @@ +![Moox Logs](https://github.com/mooxphp/moox/raw/main/_other/art/banner/logs.jpg) + +# Moox Logs + +This is my package logs + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/logs +php artisan mooxlogs:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package logs + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxlogs:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="logs-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="logs-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/logs/SECURITY.md b/_packages/logs/SECURITY.md new file mode 100644 index 000000000..a7bfcbc7b --- /dev/null +++ b/_packages/logs/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox Logs` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/logs/composer.json b/_packages/logs/composer.json new file mode 100644 index 000000000..f9768acbc --- /dev/null +++ b/_packages/logs/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/logs", + "description": "This is my package logs", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\Logs\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\Logs\\LogsServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/logs/config/logs.php b/_packages/logs/config/logs.php new file mode 100644 index 000000000..ba2aa0e51 --- /dev/null +++ b/_packages/logs/config/logs.php @@ -0,0 +1,20 @@ + [ + 'logs' => [ + 'enabled' => true, + 'label' => 'Logs', + 'plural_label' => 'Logss', + 'navigation_group' => 'Logs Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Logs\Resources\LogsResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/logs/database/migrations/create_logs_table.php.stub b/_packages/logs/database/migrations/create_logs_table.php.stub new file mode 100644 index 000000000..2362e5b48 --- /dev/null +++ b/_packages/logs/database/migrations/create_logs_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('logs'); + } +}; diff --git a/_packages/logs/resources/lang/de/translations.php b/_packages/logs/resources/lang/de/translations.php new file mode 100644 index 000000000..2919f4815 --- /dev/null +++ b/_packages/logs/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'Logs', + 'title' => 'Logs', + 'navigation_label' => 'Logs', + 'navigation_group' => 'Logs Gruppe', + 'totalone' => 'Logs Eins', + 'totaltwo' => 'Logs Zwei', + 'totalthree' => 'Logs Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/logs/resources/lang/en/translations.php b/_packages/logs/resources/lang/en/translations.php new file mode 100644 index 000000000..73c9a8ff0 --- /dev/null +++ b/_packages/logs/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'Logs', + 'title' => 'Logs', + 'navigation_label' => 'Logs', + 'navigation_group' => 'Logs Group', + 'totalone' => 'Logs One', + 'totaltwo' => 'Logs Two', + 'totalthree' => 'Logs Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/logs/resources/lang/es/translations.php b/_packages/logs/resources/lang/es/translations.php new file mode 100644 index 000000000..85b23bce8 --- /dev/null +++ b/_packages/logs/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'Logs', + 'title' => 'Logs', + 'navigation_label' => 'Logs', + 'navigation_group' => 'Logs Grupo', + 'totalone' => 'Logs Uno', + 'totaltwo' => 'Logs Dos', + 'totalthree' => 'Logs Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/logs/resources/lang/nb_NO/translations.php b/_packages/logs/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/logs/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/logs/src/Commands/InstallCommand.php b/_packages/logs/src/Commands/InstallCommand.php new file mode 100644 index 000000000..1df92e884 --- /dev/null +++ b/_packages/logs/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing Logs Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'logs-config']); + + $this->comment('Publishing Logs Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'logs-migrations']); + $this->call('migrate'); + $this->info('Logs was installed successfully'); + } +} diff --git a/_packages/logs/src/LogsPlugin.php b/_packages/logs/src/LogsPlugin.php new file mode 100644 index 000000000..8339c183a --- /dev/null +++ b/_packages/logs/src/LogsPlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('logs.resources.logs.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('logs.resources.logs.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('logs.resources.logs.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('logs.resources.logs.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('logs.resources.logs.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('logs.resources.logs.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('logs.resources.logs.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('logs.resources.logs.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('logs::translations.breadcrumb'); + } +} diff --git a/_packages/logs/src/LogsServiceProvider.php b/_packages/logs/src/LogsServiceProvider.php new file mode 100644 index 000000000..701d9d1ef --- /dev/null +++ b/_packages/logs/src/LogsServiceProvider.php @@ -0,0 +1,23 @@ +name('logs') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_logs_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/_packages/logs/src/Models/Logs.php b/_packages/logs/src/Models/Logs.php new file mode 100644 index 000000000..7122f63f6 --- /dev/null +++ b/_packages/logs/src/Models/Logs.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/logs/src/Resources/LogsResource.php b/_packages/logs/src/Resources/LogsResource.php new file mode 100644 index 000000000..e4bba3aa0 --- /dev/null +++ b/_packages/logs/src/Resources/LogsResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('logs::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('logs::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('logs::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + LogsWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return LogsPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return LogsPlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return LogsPlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return LogsPlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return LogsPlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return LogsPlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return LogsPlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return LogsPlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/logs/src/Resources/LogsResource/Pages/ListPage.php b/_packages/logs/src/Resources/LogsResource/Pages/ListPage.php new file mode 100644 index 000000000..f43640cf3 --- /dev/null +++ b/_packages/logs/src/Resources/LogsResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): Logs { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/logs/src/Resources/LogsResource/Widgets/LogsWidgets.php b/_packages/logs/src/Resources/LogsResource/Widgets/LogsWidgets.php new file mode 100644 index 000000000..50dfa5c41 --- /dev/null +++ b/_packages/logs/src/Resources/LogsResource/Widgets/LogsWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('logs::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('logs::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('logs::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/page/.gitignore b/_packages/page/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/page/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/page/CHANGELOG.md b/_packages/page/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/page/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/page/LICENSE.md b/_packages/page/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/page/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/page/README.md b/_packages/page/README.md new file mode 100644 index 000000000..6279e66b5 --- /dev/null +++ b/_packages/page/README.md @@ -0,0 +1,52 @@ +![Moox Page](https://github.com/mooxphp/moox/raw/main/_other/art/banner/page.jpg) + +# Moox Page + +This is my package page + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/page +php artisan mooxpage:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package page + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxpage:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="page-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="page-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/page/SECURITY.md b/_packages/page/SECURITY.md new file mode 100644 index 000000000..fc754ba7c --- /dev/null +++ b/_packages/page/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox Page` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/page/composer.json b/_packages/page/composer.json new file mode 100644 index 000000000..cc98615fc --- /dev/null +++ b/_packages/page/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/page", + "description": "This is my package page", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\Page\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\Page\\PageServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/page/config/page.php b/_packages/page/config/page.php new file mode 100644 index 000000000..90bbd461a --- /dev/null +++ b/_packages/page/config/page.php @@ -0,0 +1,20 @@ + [ + 'page' => [ + 'enabled' => true, + 'label' => 'Page', + 'plural_label' => 'Pages', + 'navigation_group' => 'Page Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Page\Resources\PageResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/page/database/migrations/create_page_table.php.stub b/_packages/page/database/migrations/create_page_table.php.stub new file mode 100644 index 000000000..91332d81d --- /dev/null +++ b/_packages/page/database/migrations/create_page_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('page'); + } +}; diff --git a/_packages/page/resources/lang/de/translations.php b/_packages/page/resources/lang/de/translations.php new file mode 100644 index 000000000..30b86d20b --- /dev/null +++ b/_packages/page/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'Page', + 'title' => 'Page', + 'navigation_label' => 'Page', + 'navigation_group' => 'Page Gruppe', + 'totalone' => 'Page Eins', + 'totaltwo' => 'Page Zwei', + 'totalthree' => 'Page Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/page/resources/lang/en/translations.php b/_packages/page/resources/lang/en/translations.php new file mode 100644 index 000000000..ef9b63b1d --- /dev/null +++ b/_packages/page/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'Page', + 'title' => 'Page', + 'navigation_label' => 'Page', + 'navigation_group' => 'Page Group', + 'totalone' => 'Page One', + 'totaltwo' => 'Page Two', + 'totalthree' => 'Page Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/page/resources/lang/es/translations.php b/_packages/page/resources/lang/es/translations.php new file mode 100644 index 000000000..13539ecfa --- /dev/null +++ b/_packages/page/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'Page', + 'title' => 'Page', + 'navigation_label' => 'Page', + 'navigation_group' => 'Page Grupo', + 'totalone' => 'Page Uno', + 'totaltwo' => 'Page Dos', + 'totalthree' => 'Page Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/page/resources/lang/nb_NO/translations.php b/_packages/page/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/page/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/page/src/Commands/InstallCommand.php b/_packages/page/src/Commands/InstallCommand.php new file mode 100644 index 000000000..29288c261 --- /dev/null +++ b/_packages/page/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing Page Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'page-config']); + + $this->comment('Publishing Page Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'page-migrations']); + $this->call('migrate'); + $this->info('Page was installed successfully'); + } +} diff --git a/_packages/page/src/Models/Page.php b/_packages/page/src/Models/Page.php new file mode 100644 index 000000000..68bf907d2 --- /dev/null +++ b/_packages/page/src/Models/Page.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/page/src/PagePlugin.php b/_packages/page/src/PagePlugin.php new file mode 100644 index 000000000..357b22ca9 --- /dev/null +++ b/_packages/page/src/PagePlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('page.resources.page.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('page.resources.page.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('page.resources.page.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('page.resources.page.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('page.resources.page.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('page.resources.page.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('page.resources.page.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('page.resources.page.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('page::translations.breadcrumb'); + } +} diff --git a/_packages/page/src/PageServiceProvider.php b/_packages/page/src/PageServiceProvider.php new file mode 100644 index 000000000..164d8505b --- /dev/null +++ b/_packages/page/src/PageServiceProvider.php @@ -0,0 +1,23 @@ +name('page') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_page_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/_packages/page/src/Resources/PageResource.php b/_packages/page/src/Resources/PageResource.php new file mode 100644 index 000000000..41983e15f --- /dev/null +++ b/_packages/page/src/Resources/PageResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('page::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('page::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('page::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + PageWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return PagePlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return PagePlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return PagePlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return PagePlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return PagePlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return PagePlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return PagePlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return PagePlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/page/src/Resources/PageResource/Pages/ListPage.php b/_packages/page/src/Resources/PageResource/Pages/ListPage.php new file mode 100644 index 000000000..f4b4349fd --- /dev/null +++ b/_packages/page/src/Resources/PageResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): Page { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/page/src/Resources/PageResource/Widgets/PageWidgets.php b/_packages/page/src/Resources/PageResource/Widgets/PageWidgets.php new file mode 100644 index 000000000..83d11536f --- /dev/null +++ b/_packages/page/src/Resources/PageResource/Widgets/PageWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('page::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('page::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('page::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/user/.gitignore b/_packages/user/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_packages/user/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_packages/user/CHANGELOG.md b/_packages/user/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_packages/user/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_packages/user/LICENSE.md b/_packages/user/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_packages/user/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_packages/user/README.md b/_packages/user/README.md new file mode 100644 index 000000000..89f8b0bab --- /dev/null +++ b/_packages/user/README.md @@ -0,0 +1,52 @@ +![Moox User](https://github.com/mooxphp/moox/raw/main/_other/art/banner/user.jpg) + +# Moox User + +This is my package user + +## Quick Installation + +These two commmands are all you need to install the package: + +```bash +composer require moox/user +php artisan mooxuser:install +``` + +Curious what the install command does? See manual installation below. + +## What does it do? + + +This is my package user + + + +## Manual Installation + +Instead of using the install-command `php artisan mooxuser:install` you are able to install this package manually step by step: + +```bash +// Publish and run the migrations: +php artisan vendor:publish --tag="user-migrations" +php artisan migrate + +// Publish the config file with: +php artisan vendor:publish --tag="user-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_packages/user/SECURITY.md b/_packages/user/SECURITY.md new file mode 100644 index 000000000..037d9190e --- /dev/null +++ b/_packages/user/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox User` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_packages/user/composer.json b/_packages/user/composer.json new file mode 100644 index 000000000..a136324ac --- /dev/null +++ b/_packages/user/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/user", + "description": "This is my package user", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://moox.org/", + "license": "MIT", + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\User\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\User\\UserServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_packages/user/config/user.php b/_packages/user/config/user.php new file mode 100644 index 000000000..ee5c6016d --- /dev/null +++ b/_packages/user/config/user.php @@ -0,0 +1,20 @@ + [ + 'user' => [ + 'enabled' => true, + 'label' => 'User', + 'plural_label' => 'Users', + 'navigation_group' => 'User Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\User\Resources\UserResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_packages/user/database/migrations/create_user_table.php.stub b/_packages/user/database/migrations/create_user_table.php.stub new file mode 100644 index 000000000..34ffe9bc1 --- /dev/null +++ b/_packages/user/database/migrations/create_user_table.php.stub @@ -0,0 +1,32 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + + { + Schema::dropIfExists('user'); + } +}; diff --git a/_packages/user/resources/lang/de/translations.php b/_packages/user/resources/lang/de/translations.php new file mode 100644 index 000000000..6d0992172 --- /dev/null +++ b/_packages/user/resources/lang/de/translations.php @@ -0,0 +1,14 @@ + 'User', + 'title' => 'User', + 'navigation_label' => 'User', + 'navigation_group' => 'User Gruppe', + 'totalone' => 'User Eins', + 'totaltwo' => 'User Zwei', + 'totalthree' => 'User Drei', + 'name' => 'Name', + 'started_at' => 'Gestartet', + 'failed' => 'failed', +]; diff --git a/_packages/user/resources/lang/en/translations.php b/_packages/user/resources/lang/en/translations.php new file mode 100644 index 000000000..2be9f7657 --- /dev/null +++ b/_packages/user/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'User', + 'title' => 'User', + 'navigation_label' => 'User', + 'navigation_group' => 'User Group', + 'totalone' => 'User One', + 'totaltwo' => 'User Two', + 'totalthree' => 'User Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_packages/user/resources/lang/es/translations.php b/_packages/user/resources/lang/es/translations.php new file mode 100644 index 000000000..c0de05394 --- /dev/null +++ b/_packages/user/resources/lang/es/translations.php @@ -0,0 +1,14 @@ + 'User', + 'title' => 'User', + 'navigation_label' => 'User', + 'navigation_group' => 'User Grupo', + 'totalone' => 'User Uno', + 'totaltwo' => 'User Dos', + 'totalthree' => 'User Trés', + 'name' => 'Nombre', + 'started_at' => 'Empezó a las', + 'failed' => 'failed', +]; diff --git a/_packages/user/resources/lang/nb_NO/translations.php b/_packages/user/resources/lang/nb_NO/translations.php new file mode 100644 index 000000000..4c7cc2a3c --- /dev/null +++ b/_packages/user/resources/lang/nb_NO/translations.php @@ -0,0 +1,14 @@ + 'Bygger', + 'title' => 'Bygger', + 'navigation_label' => 'Bygger', + 'navigation_group' => 'Byggergruppe', + 'totalone' => 'Bygger én', + 'totaltwo' => 'Bygger to', + 'totalthree' => 'Bygger tre', + 'name' => 'Navn', + 'started_at' => 'Startet', + 'failed' => 'mislyktes', +]; diff --git a/_packages/user/src/Commands/InstallCommand.php b/_packages/user/src/Commands/InstallCommand.php new file mode 100644 index 000000000..4ad1ef80b --- /dev/null +++ b/_packages/user/src/Commands/InstallCommand.php @@ -0,0 +1,36 @@ +comment('Publishing User Configuration...'); + $this->callSilent('vendor:publish', ['--tag' => 'user-config']); + + $this->comment('Publishing User Migrations...'); + $this->callSilent('vendor:publish', ['--tag' => 'user-migrations']); + $this->call('migrate'); + $this->info('User was installed successfully'); + } +} diff --git a/_packages/user/src/Models/User.php b/_packages/user/src/Models/User.php new file mode 100644 index 000000000..c0f760080 --- /dev/null +++ b/_packages/user/src/Models/User.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_packages/user/src/Resources/UserResource.php b/_packages/user/src/Resources/UserResource.php new file mode 100644 index 000000000..7ba5f3292 --- /dev/null +++ b/_packages/user/src/Resources/UserResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('user::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('user::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('user::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + UserWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return UserPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return UserPlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return UserPlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return UserPlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return UserPlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return UserPlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return UserPlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return UserPlugin::get()->getNavigationIcon(); + } +} diff --git a/_packages/user/src/Resources/UserResource/Pages/ListPage.php b/_packages/user/src/Resources/UserResource/Pages/ListPage.php new file mode 100644 index 000000000..882876f49 --- /dev/null +++ b/_packages/user/src/Resources/UserResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): User { + return $model::create($data); + }), + ]; + } +} diff --git a/_packages/user/src/Resources/UserResource/Widgets/UserWidgets.php b/_packages/user/src/Resources/UserResource/Widgets/UserWidgets.php new file mode 100644 index 000000000..a94f5ea30 --- /dev/null +++ b/_packages/user/src/Resources/UserResource/Widgets/UserWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('user::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('user::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('user::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_packages/user/src/UserPlugin.php b/_packages/user/src/UserPlugin.php new file mode 100644 index 000000000..f77bdce72 --- /dev/null +++ b/_packages/user/src/UserPlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('user.resources.user.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('user.resources.user.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('user.resources.user.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('user.resources.user.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('user.resources.user.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('user.resources.user.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('user.resources.user.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('user.resources.user.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('user::translations.breadcrumb'); + } +} diff --git a/_packages/user/src/UserServiceProvider.php b/_packages/user/src/UserServiceProvider.php new file mode 100644 index 000000000..f353a6d9c --- /dev/null +++ b/_packages/user/src/UserServiceProvider.php @@ -0,0 +1,23 @@ +name('user') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_user_table') + ->hasCommand(InstallCommand::class); + } +} diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 0956242df..40698eed6 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -17,11 +17,18 @@ use Illuminate\Session\Middleware\AuthenticateSession; use Illuminate\Session\Middleware\StartSession; use Illuminate\View\Middleware\ShareErrorsFromSession; +use Moox\Blog\BlogPlugin; use Moox\Builder\BuilderPlugin; +use Moox\Core\CorePlugin; +use Moox\Data\DataPlugin; +use Moox\File\FilePlugin; use Moox\Jobs\JobsBatchesPlugin; use Moox\Jobs\JobsFailedPlugin; use Moox\Jobs\JobsPlugin; use Moox\Jobs\JobsWaitingPlugin; +use Moox\Logs\LogsPlugin; +use Moox\Page\PagePlugin; +use Moox\User\UserPlugin; class AdminPanelProvider extends PanelProvider { @@ -65,6 +72,14 @@ public function panel(Panel $panel): Panel JobsWaitingPlugin::make(), JobsFailedPlugin::make(), JobsBatchesPlugin::make(), + BlogPlugin::make(), + CorePlugin::make(), + DataPlugin::make(), + FilePlugin::make(), + JobsPlugin::make(), + LogsPlugin::make(), + PagePlugin::make(), + UserPlugin::make(), ]); } } diff --git a/composer.json b/composer.json index 7b61f24c3..e911d5eb6 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,37 @@ "type": "path", "url": "_other/builder" }, + { + "type": "path", + "url": "_packages/blog" + }, + { + "type": "path", + "url": "_packages/core" + }, + { + "type": "path", + "url": "_packages/data" + }, + { + "type": "path", + "url": "_packages/file" + }, { "type": "path", "url": "_packages/jobs" + }, + { + "type": "path", + "url": "_packages/logs" + }, + { + "type": "path", + "url": "_packages/page" + }, + { + "type": "path", + "url": "_packages/user" } ], "license": "MIT", @@ -32,7 +60,14 @@ "laravel/tinker": "^2.8", "livewire/livewire": "^3.0", "moox/builder": "*", + "moox/blog": "*", + "moox/core": "*", + "moox/data": "*", + "moox/file": "*", "moox/jobs": "*", + "moox/logs": "*", + "moox/page": "*", + "moox/user": "*", "wikimedia/composer-merge-plugin": "^2.1" }, "require-dev": { @@ -116,4 +151,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 2be2c5526..397dcb466 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "2da639b6297b14cb04ca9db509b754a8", + "content-hash": "e959e3308ee049cae1be27128dbd987b", "packages": [ { "name": "blade-ui-kit/blade-heroicons", @@ -1102,16 +1102,16 @@ }, { "name": "filament/actions", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", - "reference": "14b89222a5de0c987fdde16797fa0cadf6b62d99" + "reference": "4da529f7638dbcc4bf5824e61d863790a8b86b37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/actions/zipball/14b89222a5de0c987fdde16797fa0cadf6b62d99", - "reference": "14b89222a5de0c987fdde16797fa0cadf6b62d99", + "url": "https://api.github.com/repos/filamentphp/actions/zipball/4da529f7638dbcc4bf5824e61d863790a8b86b37", + "reference": "4da529f7638dbcc4bf5824e61d863790a8b86b37", "shasum": "" }, "require": { @@ -1149,20 +1149,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-12-07T12:32:28+00:00" + "time": "2023-12-08T13:52:58+00:00" }, { "name": "filament/filament", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", - "reference": "afe0c3316db11cdabfc2b12e201b7999d1146029" + "reference": "c978aff44795851f23f74a058d82a9d2f88317c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/panels/zipball/afe0c3316db11cdabfc2b12e201b7999d1146029", - "reference": "afe0c3316db11cdabfc2b12e201b7999d1146029", + "url": "https://api.github.com/repos/filamentphp/panels/zipball/c978aff44795851f23f74a058d82a9d2f88317c3", + "reference": "c978aff44795851f23f74a058d82a9d2f88317c3", "shasum": "" }, "require": { @@ -1214,20 +1214,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-12-07T12:32:31+00:00" + "time": "2023-12-08T13:53:03+00:00" }, { "name": "filament/forms", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "56c3f923784b45f59b58ac76ce98ec044f4a106f" + "reference": "0776650652724090f607d3b18a8925af1701888e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/56c3f923784b45f59b58ac76ce98ec044f4a106f", - "reference": "56c3f923784b45f59b58ac76ce98ec044f4a106f", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/0776650652724090f607d3b18a8925af1701888e", + "reference": "0776650652724090f607d3b18a8925af1701888e", "shasum": "" }, "require": { @@ -1270,11 +1270,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-12-07T12:32:31+00:00" + "time": "2023-12-08T13:53:04+00:00" }, { "name": "filament/infolists", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", @@ -1325,7 +1325,7 @@ }, { "name": "filament/notifications", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", @@ -1377,7 +1377,7 @@ }, { "name": "filament/support", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", @@ -1434,16 +1434,16 @@ }, { "name": "filament/tables", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", - "reference": "e595f934dcbc9c227c76f35a719291b94fd8fa28" + "reference": "9bc21de770982ede0024f12ff86ba69afc67e0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/tables/zipball/e595f934dcbc9c227c76f35a719291b94fd8fa28", - "reference": "e595f934dcbc9c227c76f35a719291b94fd8fa28", + "url": "https://api.github.com/repos/filamentphp/tables/zipball/9bc21de770982ede0024f12ff86ba69afc67e0f9", + "reference": "9bc21de770982ede0024f12ff86ba69afc67e0f9", "shasum": "" }, "require": { @@ -1483,11 +1483,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-12-07T12:32:45+00:00" + "time": "2023-12-08T13:53:04+00:00" }, { "name": "filament/widgets", - "version": "v3.1.15", + "version": "v3.1.16", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", @@ -3495,9 +3495,56 @@ ], "time": "2023-10-27T15:32:31+00:00" }, + { + "name": "moox/blog", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/blog", + "reference": "3480ea3a23bd4bef7039bf4ee3a24da2f58b64d3" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\Blog\\BlogServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\Blog\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package blog", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, { "name": "moox/builder", - "version": "dev-main", + "version": "dev-feature/core", "dist": { "type": "path", "url": "_other/builder", @@ -3542,9 +3589,150 @@ "relative": true } }, + { + "name": "moox/core", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/core", + "reference": "4315ffb143004b0ec28c63e4d8585d57c4cf470f" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\Core\\CoreServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\Core\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package core", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, + { + "name": "moox/data", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/data", + "reference": "fd2cb3a0eec1529f4e6c184df32e7eceb957f709" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\Data\\DataServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\Data\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package data", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, + { + "name": "moox/file", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/file", + "reference": "0b501492a7c9fb3d3f3f3f7e04665e3f6b5e05e0" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\File\\FileServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\File\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package file", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, { "name": "moox/jobs", - "version": "dev-main", + "version": "dev-feature/core", "dist": { "type": "path", "url": "_packages/jobs", @@ -3599,6 +3787,147 @@ "relative": true } }, + { + "name": "moox/logs", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/logs", + "reference": "6c35493099083e80f39ab09fbeeca96674685c54" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\Logs\\LogsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\Logs\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package logs", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, + { + "name": "moox/page", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/page", + "reference": "b68768a0a2f44f321b3af4d43af7b9998334b948" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\Page\\PageServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\Page\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package page", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, + { + "name": "moox/user", + "version": "dev-feature/core", + "dist": { + "type": "path", + "url": "_packages/user", + "reference": "017d8674bc210e04bdb86d55a1b7c5630ba9fd45" + }, + "require": { + "filament/filament": "^3.0", + "spatie/laravel-package-tools": "^1.13.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Moox\\User\\UserServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Moox\\User\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Moox Developer", + "email": "dev@moox.org", + "role": "Developer" + } + ], + "description": "This is my package user", + "homepage": "https://moox.org/", + "keywords": [ + "Filament", + "Filament plugin", + "Laravel", + "Laravel package" + ], + "transport-options": { + "relative": true + } + }, { "name": "nesbot/carbon", "version": "2.72.0", @@ -5189,20 +5518,20 @@ }, { "name": "symfony/css-selector", - "version": "v6.4.0", + "version": "v7.0.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "d036c6c0d0b09e24a14a35f8292146a658f986e4" + "reference": "bb51d46e53ef8d50d523f0c5faedba056a27943e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/d036c6c0d0b09e24a14a35f8292146a658f986e4", - "reference": "d036c6c0d0b09e24a14a35f8292146a658f986e4", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/bb51d46e53ef8d50d523f0c5faedba056a27943e", + "reference": "bb51d46e53ef8d50d523f0c5faedba056a27943e", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "type": "library", "autoload": { @@ -5234,7 +5563,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.4.0" + "source": "https://github.com/symfony/css-selector/tree/v7.0.0" }, "funding": [ { @@ -5250,7 +5579,7 @@ "type": "tidelift" } ], - "time": "2023-10-31T08:40:20+00:00" + "time": "2023-10-31T17:59:56+00:00" }, { "name": "symfony/deprecation-contracts", @@ -7421,23 +7750,23 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.6", + "version": "v2.2.7", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c" + "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/c42125b83a4fa63b187fdf29f9c93cb7733da30c", - "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb", + "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" @@ -7468,9 +7797,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.6" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7" }, - "time": "2023-01-03T09:29:04+00:00" + "time": "2023-12-08T13:03:43+00:00" }, { "name": "vlucas/phpdotenv", @@ -9904,16 +10233,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.47", + "version": "1.10.48", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39" + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", "shasum": "" }, "require": { @@ -9962,7 +10291,7 @@ "type": "tidelift" } ], - "time": "2023-12-01T15:19:17+00:00" + "time": "2023-12-08T14:34:28+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/config/blog.php b/config/blog.php new file mode 100644 index 000000000..96528bbce --- /dev/null +++ b/config/blog.php @@ -0,0 +1,20 @@ + [ + 'blog' => [ + 'enabled' => true, + 'label' => 'Blog', + 'plural_label' => 'Blogs', + 'navigation_group' => 'Blog Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Blog\Resources\BlogResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/core.php b/config/core.php new file mode 100644 index 000000000..346009fb9 --- /dev/null +++ b/config/core.php @@ -0,0 +1,20 @@ + [ + 'core' => [ + 'enabled' => true, + 'label' => 'Core', + 'plural_label' => 'Cores', + 'navigation_group' => 'Core Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Core\Resources\CoreResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/data.php b/config/data.php new file mode 100644 index 000000000..521e04d0c --- /dev/null +++ b/config/data.php @@ -0,0 +1,20 @@ + [ + 'data' => [ + 'enabled' => true, + 'label' => 'Data', + 'plural_label' => 'Datas', + 'navigation_group' => 'Data Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Data\Resources\DataResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/file.php b/config/file.php new file mode 100644 index 000000000..f8885cc12 --- /dev/null +++ b/config/file.php @@ -0,0 +1,20 @@ + [ + 'file' => [ + 'enabled' => true, + 'label' => 'File', + 'plural_label' => 'Files', + 'navigation_group' => 'File Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\File\Resources\FileResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/logs.php b/config/logs.php new file mode 100644 index 000000000..ba2aa0e51 --- /dev/null +++ b/config/logs.php @@ -0,0 +1,20 @@ + [ + 'logs' => [ + 'enabled' => true, + 'label' => 'Logs', + 'plural_label' => 'Logss', + 'navigation_group' => 'Logs Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Logs\Resources\LogsResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/tallui.php b/config/moox.php similarity index 95% rename from config/tallui.php rename to config/moox.php index ce23aa6fc..23d86b4a0 100644 --- a/config/tallui.php +++ b/config/moox.php @@ -4,7 +4,7 @@ /* |-------------------------------------------------------------------------- - | TallUI Custom + | Moox Custom |-------------------------------------------------------------------------- | | This configures custom views and custom routes. diff --git a/config/page.php b/config/page.php new file mode 100644 index 000000000..90bbd461a --- /dev/null +++ b/config/page.php @@ -0,0 +1,20 @@ + [ + 'page' => [ + 'enabled' => true, + 'label' => 'Page', + 'plural_label' => 'Pages', + 'navigation_group' => 'Page Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Page\Resources\PageResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/config/user.php b/config/user.php new file mode 100644 index 000000000..ee5c6016d --- /dev/null +++ b/config/user.php @@ -0,0 +1,20 @@ + [ + 'user' => [ + 'enabled' => true, + 'label' => 'User', + 'plural_label' => 'Users', + 'navigation_group' => 'User Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\User\Resources\UserResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/database/migrations/2023_12_08_153354_create_blog_table.php b/database/migrations/2023_12_08_153354_create_blog_table.php new file mode 100644 index 000000000..a05c2128a --- /dev/null +++ b/database/migrations/2023_12_08_153354_create_blog_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('blog'); + } +}; diff --git a/database/migrations/2023_12_08_153405_create_core_table.php b/database/migrations/2023_12_08_153405_create_core_table.php new file mode 100644 index 000000000..a6094abc9 --- /dev/null +++ b/database/migrations/2023_12_08_153405_create_core_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('core'); + } +}; diff --git a/database/migrations/2023_12_08_153414_create_data_table.php b/database/migrations/2023_12_08_153414_create_data_table.php new file mode 100644 index 000000000..4db76025d --- /dev/null +++ b/database/migrations/2023_12_08_153414_create_data_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('data'); + } +}; diff --git a/database/migrations/2023_12_08_153423_create_file_table.php b/database/migrations/2023_12_08_153423_create_file_table.php new file mode 100644 index 000000000..8f7e516a6 --- /dev/null +++ b/database/migrations/2023_12_08_153423_create_file_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('file'); + } +}; diff --git a/database/migrations/2023_12_08_153438_create_logs_table.php b/database/migrations/2023_12_08_153438_create_logs_table.php new file mode 100644 index 000000000..f0dcafb88 --- /dev/null +++ b/database/migrations/2023_12_08_153438_create_logs_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('logs'); + } +}; diff --git a/database/migrations/2023_12_08_153446_create_page_table.php b/database/migrations/2023_12_08_153446_create_page_table.php new file mode 100644 index 000000000..c9ccb43b1 --- /dev/null +++ b/database/migrations/2023_12_08_153446_create_page_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('page'); + } +}; diff --git a/database/migrations/2023_12_08_153454_create_user_table.php b/database/migrations/2023_12_08_153454_create_user_table.php new file mode 100644 index 000000000..049be1496 --- /dev/null +++ b/database/migrations/2023_12_08_153454_create_user_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('user'); + } +}; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3cf78228c..ee324f9b5 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,25 +2,14 @@ includes: - phpstan-baseline.neon parameters: - level: 8 + level: 2 paths: - - _data - - _packages - - _themes + - _custom - _other + - _packages - app excludePaths: - - '_data/*/build/*' - - '_packages/*/build/*' - - '_themes/admin/*/build/*' - - '_themes/website/*/build/*' - - '_other/*/build/*' - - '_components/*/vendor/*' - - '_data/*/vendor/*' - - '_icons/*/vendor/*' - '_packages/*/vendor/*' - - '_themes/admin/*/vendor/*' - - '_themes/website/*/vendor/*' - '_other/*/vendor/*' - '_other/builder/*' - '_other/satis/*' diff --git a/public/js/filament/forms/components/key-value.js b/public/js/filament/forms/components/key-value.js index 6b3a02d69..3450bdffe 100644 --- a/public/js/filament/forms/components/key-value.js +++ b/public/js/filament/forms/components/key-value.js @@ -1 +1 @@ -function r({state:i}){return{state:i,rows:[],shouldUpdateRows:!0,init:function(){this.updateRows(),this.rows.length<=0&&this.addRow(),this.updateState(),this.$watch("state",(t,e)=>{let s=o=>o===null?0:Array.isArray(o)?o.length:typeof o!="object"?0:Object.keys(o).length;s(t)===0&&s(e)===0||this.updateRows()})},addRow:function(){this.rows.push({key:"",value:""}),this.updateState()},deleteRow:function(t){this.rows.splice(t,1),this.rows.length<=0&&this.addRow(),this.updateState()},reorderRows:function(t){let e=Alpine.raw(this.rows),s=e.splice(t.oldIndex,1)[0];e.splice(t.newIndex,0,s),this.rows=e,this.updateState()},updateRows:function(){if(!this.shouldUpdateRows){this.shouldUpdateRows=!0;return}let t=[];for(let[e,s]of Object.entries(this.state??{}))t.push({key:e,value:s});this.rows=t},updateState:function(){let t={};this.rows.forEach(e=>{e.key===""||e.key===null||(t[e.key]=e.value)}),this.shouldUpdateRows=!1,this.state=t}}}export{r as default}; +function r({state:i}){return{state:i,rows:[],shouldUpdateRows:!0,init:function(){this.updateRows(),this.rows.length<=0?this.rows.push({key:"",value:""}):this.updateState(),this.$watch("state",(t,e)=>{let s=o=>o===null?0:Array.isArray(o)?o.length:typeof o!="object"?0:Object.keys(o).length;s(t)===0&&s(e)===0||this.updateRows()})},addRow:function(){this.rows.push({key:"",value:""}),this.updateState()},deleteRow:function(t){this.rows.splice(t,1),this.rows.length<=0&&this.addRow(),this.updateState()},reorderRows:function(t){let e=Alpine.raw(this.rows),s=e.splice(t.oldIndex,1)[0];e.splice(t.newIndex,0,s),this.rows=e,this.updateState()},updateRows:function(){if(!this.shouldUpdateRows){this.shouldUpdateRows=!0;return}let t=[];for(let[e,s]of Object.entries(this.state??{}))t.push({key:e,value:s});this.rows=t},updateState:function(){let t={};this.rows.forEach(e=>{e.key===""||e.key===null||(t[e.key]=e.value)}),this.shouldUpdateRows=!1,this.state=t}}}export{r as default}; diff --git a/resources/views/custom/overview.blade.php b/resources/views/custom/overview.blade.php index 1802452ce..62bc83d10 100644 --- a/resources/views/custom/overview.blade.php +++ b/resources/views/custom/overview.blade.php @@ -11,7 +11,7 @@

- @foreach (config('tallui.custom_views') as $key => $value) + @foreach (config('moox.custom_views') as $key => $value) PHPStan Level 5 diff --git a/routes/web.php b/routes/web.php index 6a8520cf2..9faba39b8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,7 +27,7 @@ return view('components.overview'); }); -$custom_parts = config('tallui.custom_views'); +$custom_parts = config('moox.custom_views'); if (is_array($custom_parts)) { foreach ($custom_parts as $custom_part) { $custom_view = 'custom.'.$custom_part; @@ -38,7 +38,7 @@ } } -$custom_parts = explode(', ', config('tallui.custom_routes')); +$custom_parts = explode(', ', config('moox.custom_routes')); if (is_array($custom_parts)) { foreach ($custom_parts as $custom_part) { $tui_routes = base_path('routes/custom_'.$custom_part.'.php');