From 1474e4b653c9f5768bf03791db33e89b160242f7 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Fri, 19 May 2023 23:30:10 +0300 Subject: [PATCH 1/5] indices_to_posts --- ...2_add_indices_to_posts.php => add_indices_to_posts.php.stub} | 0 src/SkyServiceProvider.php | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename database/migrations/{2022_07_04_104832_add_indices_to_posts.php => add_indices_to_posts.php.stub} (100%) diff --git a/database/migrations/2022_07_04_104832_add_indices_to_posts.php b/database/migrations/add_indices_to_posts.php.stub similarity index 100% rename from database/migrations/2022_07_04_104832_add_indices_to_posts.php rename to database/migrations/add_indices_to_posts.php.stub diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php index 720821c..e760d33 100644 --- a/src/SkyServiceProvider.php +++ b/src/SkyServiceProvider.php @@ -50,7 +50,7 @@ protected function getCommands(): array public function packageConfiguring(Package $package): void { $package - ->hasMigrations(['create_posts_table', 'create_faqs_table', 'modify_posts_columns']) + ->hasMigrations(['create_posts_table', 'create_faqs_table', 'modify_posts_columns','add_indices_to_posts']) ->hasRoute('web'); } From 8c1d1a8eaf4c000aa95465574d6d26dc69921941 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Sat, 20 May 2023 20:37:09 +0300 Subject: [PATCH 2/5] new addone: Library --- composer.lock | 314 +++++++++++------- config/zeus-sky.php | 17 + database/factories/LibraryFactory.php | 29 ++ .../migrations/add_indices_to_posts.php.stub | 18 - .../migrations/create_library_table.php.stub | 36 ++ database/seeders/SkySeeder.php | 7 + docs/addons.md | 6 + docs/configuration.md | 22 ++ .../themes/zeus/addons/library-item.blade.php | 50 +++ .../themes/zeus/addons/library.blade.php | 40 +++ routes/web.php | 11 + src/Filament/Resources/LibraryResource.php | 145 ++++++++ .../LibraryResource/Pages/CreateLibrary.php | 13 + .../LibraryResource/Pages/EditLibrary.php | 13 + .../LibraryResource/Pages/ListLibrary.php | 13 + src/Filament/Resources/PostResource.php | 6 +- src/Http/Livewire/Library.php | 25 ++ src/Http/Livewire/LibraryItem.php | 31 ++ src/Models/Library.php | 50 +++ src/Models/Tag.php | 5 + src/SkyServiceProvider.php | 7 +- 21 files changed, 709 insertions(+), 149 deletions(-) create mode 100644 database/factories/LibraryFactory.php delete mode 100644 database/migrations/add_indices_to_posts.php.stub create mode 100644 database/migrations/create_library_table.php.stub create mode 100644 resources/views/themes/zeus/addons/library-item.blade.php create mode 100644 resources/views/themes/zeus/addons/library.blade.php create mode 100644 src/Filament/Resources/LibraryResource.php create mode 100644 src/Filament/Resources/LibraryResource/Pages/CreateLibrary.php create mode 100644 src/Filament/Resources/LibraryResource/Pages/EditLibrary.php create mode 100644 src/Filament/Resources/LibraryResource/Pages/ListLibrary.php create mode 100644 src/Http/Livewire/Library.php create mode 100644 src/Http/Livewire/LibraryItem.php create mode 100644 src/Models/Library.php diff --git a/composer.lock b/composer.lock index 8a06f41..cc31af2 100644 --- a/composer.lock +++ b/composer.lock @@ -1277,16 +1277,16 @@ }, { "name": "filament/filament", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/app.git", - "reference": "eb19c51dda44ba10e5b230eb8470dfcfbbbbeba0" + "reference": "d016e8e394f4658bf5e867aa71b70aab01f9a038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/app/zipball/eb19c51dda44ba10e5b230eb8470dfcfbbbbeba0", - "reference": "eb19c51dda44ba10e5b230eb8470dfcfbbbbeba0", + "url": "https://api.github.com/repos/filamentphp/app/zipball/d016e8e394f4658bf5e867aa71b70aab01f9a038", + "reference": "d016e8e394f4658bf5e867aa71b70aab01f9a038", "shasum": "" }, "require": { @@ -1336,20 +1336,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-04-27T13:44:27+00:00" + "time": "2023-05-17T16:33:26+00:00" }, { "name": "filament/forms", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "66c247d231a1c6a90eadefb0889aae0e0216952f" + "reference": "63b484bdcf2c12baaaf6b39c66e6dd4c345fc65d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/66c247d231a1c6a90eadefb0889aae0e0216952f", - "reference": "66c247d231a1c6a90eadefb0889aae0e0216952f", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/63b484bdcf2c12baaaf6b39c66e6dd4c345fc65d", + "reference": "63b484bdcf2c12baaaf6b39c66e6dd4c345fc65d", "shasum": "" }, "require": { @@ -1394,20 +1394,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-04-27T13:44:23+00:00" + "time": "2023-05-17T16:33:21+00:00" }, { "name": "filament/notifications", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", - "reference": "42c18bf35a634f17c61ee1f8694ec3ac440903f9" + "reference": "0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/notifications/zipball/42c18bf35a634f17c61ee1f8694ec3ac440903f9", - "reference": "42c18bf35a634f17c61ee1f8694ec3ac440903f9", + "url": "https://api.github.com/repos/filamentphp/notifications/zipball/0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252", + "reference": "0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252", "shasum": "" }, "require": { @@ -1447,11 +1447,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-04-21T08:32:52+00:00" + "time": "2023-05-04T23:08:09+00:00" }, { "name": "filament/spatie-laravel-media-library-plugin", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-media-library-plugin.git", @@ -1488,7 +1488,7 @@ }, { "name": "filament/spatie-laravel-tags-plugin", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-tags-plugin.git", @@ -1525,7 +1525,7 @@ }, { "name": "filament/spatie-laravel-translatable-plugin", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", @@ -1571,16 +1571,16 @@ }, { "name": "filament/support", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", - "reference": "d99eb08d74c560d4fa6ffb79a805cc161834de7c" + "reference": "79be557c4aa426eddb250421a9270724e32a683c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/support/zipball/d99eb08d74c560d4fa6ffb79a805cc161834de7c", - "reference": "d99eb08d74c560d4fa6ffb79a805cc161834de7c", + "url": "https://api.github.com/repos/filamentphp/support/zipball/79be557c4aa426eddb250421a9270724e32a683c", + "reference": "79be557c4aa426eddb250421a9270724e32a683c", "shasum": "" }, "require": { @@ -1617,20 +1617,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-04-17T13:08:52+00:00" + "time": "2023-05-17T16:33:21+00:00" }, { "name": "filament/tables", - "version": "v2.17.30", + "version": "v2.17.41", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", - "reference": "66daf83f779c7e1663e2aa86479d5d62a70909b8" + "reference": "62653b7e77c7d602ac6ca26075c399088c55be10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/tables/zipball/66daf83f779c7e1663e2aa86479d5d62a70909b8", - "reference": "66daf83f779c7e1663e2aa86479d5d62a70909b8", + "url": "https://api.github.com/repos/filamentphp/tables/zipball/62653b7e77c7d602ac6ca26075c399088c55be10", + "reference": "62653b7e77c7d602ac6ca26075c399088c55be10", "shasum": "" }, "require": { @@ -1673,7 +1673,7 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2023-04-27T22:37:57+00:00" + "time": "2023-05-17T16:33:20+00:00" }, { "name": "fruitcake/php-cors", @@ -2094,16 +2094,16 @@ }, { "name": "lara-zeus/core", - "version": "2.4.2", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/lara-zeus/core.git", - "reference": "62fb91f7572cb7d6e06ec660fdb5d6ce307e0451" + "reference": "3ad6a7874b353f927873fb15c58decf0fc84d3b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lara-zeus/core/zipball/62fb91f7572cb7d6e06ec660fdb5d6ce307e0451", - "reference": "62fb91f7572cb7d6e06ec660fdb5d6ce307e0451", + "url": "https://api.github.com/repos/lara-zeus/core/zipball/3ad6a7874b353f927873fb15c58decf0fc84d3b0", + "reference": "3ad6a7874b353f927873fb15c58decf0fc84d3b0", "shasum": "" }, "require": { @@ -2166,7 +2166,7 @@ ], "support": { "issues": "https://github.com/lara-zeus/core/issues", - "source": "https://github.com/lara-zeus/core/tree/2.4.2" + "source": "https://github.com/lara-zeus/core/tree/2.4.3" }, "funding": [ { @@ -2174,20 +2174,20 @@ "type": "github" } ], - "time": "2023-04-24T03:57:54+00:00" + "time": "2023-05-20T17:35:13+00:00" }, { "name": "laravel/framework", - "version": "v10.9.0", + "version": "v10.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "35078125f61ef0b125edf524de934f108d4b47fd" + "reference": "21a5b6d9b669f32c10cc8ba776511b5f62599fea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/35078125f61ef0b125edf524de934f108d4b47fd", - "reference": "35078125f61ef0b125edf524de934f108d4b47fd", + "url": "https://api.github.com/repos/laravel/framework/zipball/21a5b6d9b669f32c10cc8ba776511b5f62599fea", + "reference": "21a5b6d9b669f32c10cc8ba776511b5f62599fea", "shasum": "" }, "require": { @@ -2374,7 +2374,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-04-25T13:47:18+00:00" + "time": "2023-05-16T13:59:23+00:00" }, { "name": "laravel/serializable-closure", @@ -2626,19 +2626,20 @@ }, { "name": "league/flysystem", - "version": "3.14.0", + "version": "3.15.1", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158" + "reference": "a141d430414fcb8bf797a18716b09f759a385bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e2a279d7f47d9098e479e8b21f7fb8b8de230158", - "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a141d430414fcb8bf797a18716b09f759a385bed", + "reference": "a141d430414fcb8bf797a18716b09f759a385bed", "shasum": "" }, "require": { + "league/flysystem-local": "^3.0.0", "league/mime-type-detection": "^1.0.0", "php": "^8.0.2" }, @@ -2697,7 +2698,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.14.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.15.1" }, "funding": [ { @@ -2709,7 +2710,67 @@ "type": "github" } ], - "time": "2023-04-11T18:11:47+00:00" + "time": "2023-05-04T09:04:26+00:00" + }, + { + "name": "league/flysystem-local", + "version": "3.15.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-local.git", + "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/543f64c397fefdf9cfeac443ffb6beff602796b3", + "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/flysystem": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Local\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Local filesystem adapter for Flysystem.", + "keywords": [ + "Flysystem", + "file", + "files", + "filesystem", + "local" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem-local/issues", + "source": "https://github.com/thephpleague/flysystem-local/tree/3.15.0" + }, + "funding": [ + { + "url": "https://ecologi.com/frankdejonge", + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + } + ], + "time": "2023-05-02T20:02:14+00:00" }, { "name": "league/glide", @@ -3125,16 +3186,16 @@ }, { "name": "mohamedsabil83/filament-forms-tinyeditor", - "version": "v1.7.1", + "version": "v1.7.2", "source": { "type": "git", "url": "https://github.com/mohamedsabil83/filament-forms-tinyeditor.git", - "reference": "1344599728d469f38db6cb70aa65e21aadea4c72" + "reference": "d48a711d88ef5ffb3e35fd127f47b704730c76d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mohamedsabil83/filament-forms-tinyeditor/zipball/1344599728d469f38db6cb70aa65e21aadea4c72", - "reference": "1344599728d469f38db6cb70aa65e21aadea4c72", + "url": "https://api.github.com/repos/mohamedsabil83/filament-forms-tinyeditor/zipball/d48a711d88ef5ffb3e35fd127f47b704730c76d5", + "reference": "d48a711d88ef5ffb3e35fd127f47b704730c76d5", "shasum": "" }, "require": { @@ -3191,7 +3252,7 @@ ], "support": { "issues": "https://github.com/mohamedsabil83/filament-forms-tinyeditor/issues", - "source": "https://github.com/mohamedsabil83/filament-forms-tinyeditor/tree/v1.7.1" + "source": "https://github.com/mohamedsabil83/filament-forms-tinyeditor/tree/v1.7.2" }, "funding": [ { @@ -3203,7 +3264,7 @@ "type": "github" } ], - "time": "2023-02-23T11:58:47+00:00" + "time": "2023-05-08T15:55:17+00:00" }, { "name": "monolog/monolog", @@ -4557,16 +4618,16 @@ }, { "name": "spatie/image", - "version": "2.2.5", + "version": "2.2.6", "source": { "type": "git", "url": "https://github.com/spatie/image.git", - "reference": "c78e2dbdbced9c1673800e5b813cc8a8127bc5ac" + "reference": "f72ca52acd77ca03b7843a0f86e2411ce90aecfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/image/zipball/c78e2dbdbced9c1673800e5b813cc8a8127bc5ac", - "reference": "c78e2dbdbced9c1673800e5b813cc8a8127bc5ac", + "url": "https://api.github.com/repos/spatie/image/zipball/f72ca52acd77ca03b7843a0f86e2411ce90aecfc", + "reference": "f72ca52acd77ca03b7843a0f86e2411ce90aecfc", "shasum": "" }, "require": { @@ -4610,7 +4671,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/image/tree/2.2.5" + "source": "https://github.com/spatie/image/tree/2.2.6" }, "funding": [ { @@ -4622,7 +4683,7 @@ "type": "github" } ], - "time": "2023-01-19T17:06:04+00:00" + "time": "2023-05-06T10:20:33+00:00" }, { "name": "spatie/image-optimizer", @@ -4747,16 +4808,16 @@ }, { "name": "spatie/laravel-medialibrary", - "version": "10.9.1", + "version": "10.9.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-medialibrary.git", - "reference": "99b703e63a16fedeb00174b4657b65751b74e36e" + "reference": "3bd7093d1c71807e85d1afd1bc7b506243210837" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/99b703e63a16fedeb00174b4657b65751b74e36e", - "reference": "99b703e63a16fedeb00174b4657b65751b74e36e", + "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/3bd7093d1c71807e85d1afd1bc7b506243210837", + "reference": "3bd7093d1c71807e85d1afd1bc7b506243210837", "shasum": "" }, "require": { @@ -4840,7 +4901,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-medialibrary/issues", - "source": "https://github.com/spatie/laravel-medialibrary/tree/10.9.1" + "source": "https://github.com/spatie/laravel-medialibrary/tree/10.9.2" }, "funding": [ { @@ -4852,7 +4913,7 @@ "type": "github" } ], - "time": "2023-04-21T10:23:52+00:00" + "time": "2023-05-03T08:49:22+00:00" }, { "name": "spatie/laravel-package-tools", @@ -4975,16 +5036,16 @@ }, { "name": "spatie/laravel-tags", - "version": "4.3.7", + "version": "4.4.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-tags.git", - "reference": "490a8828dc9396ddee60ed580f6b5924b7c497db" + "reference": "7cee368fc273f32b140ab7b8b81cd66026f89255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-tags/zipball/490a8828dc9396ddee60ed580f6b5924b7c497db", - "reference": "490a8828dc9396ddee60ed580f6b5924b7c497db", + "url": "https://api.github.com/repos/spatie/laravel-tags/zipball/7cee368fc273f32b140ab7b8b81cd66026f89255", + "reference": "7cee368fc273f32b140ab7b8b81cd66026f89255", "shasum": "" }, "require": { @@ -5033,7 +5094,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-tags/issues", - "source": "https://github.com/spatie/laravel-tags/tree/4.3.7" + "source": "https://github.com/spatie/laravel-tags/tree/4.4.0" }, "funding": [ { @@ -5041,20 +5102,20 @@ "type": "github" } ], - "time": "2023-01-25T09:12:48+00:00" + "time": "2023-05-16T15:24:45+00:00" }, { "name": "spatie/laravel-translatable", - "version": "6.5.0", + "version": "6.5.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-translatable.git", - "reference": "732e46b8c664a6da6d5d14751185c1844e2b5bc1" + "reference": "b8f102492f816608d832cfe9e420da6a856312cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/732e46b8c664a6da6d5d14751185c1844e2b5bc1", - "reference": "732e46b8c664a6da6d5d14751185c1844e2b5bc1", + "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/b8f102492f816608d832cfe9e420da6a856312cf", + "reference": "b8f102492f816608d832cfe9e420da6a856312cf", "shasum": "" }, "require": { @@ -5115,7 +5176,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-translatable/issues", - "source": "https://github.com/spatie/laravel-translatable/tree/6.5.0" + "source": "https://github.com/spatie/laravel-translatable/tree/6.5.1" }, "funding": [ { @@ -5123,7 +5184,7 @@ "type": "github" } ], - "time": "2023-04-20T08:54:14+00:00" + "time": "2023-05-06T10:22:13+00:00" }, { "name": "spatie/temporary-directory", @@ -7865,16 +7926,16 @@ }, { "name": "fakerphp/faker", - "version": "v1.21.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d" + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/92efad6a967f0b79c499705c69b662f738cc9e4d", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/f85772abd508bd04e20bb4b1bbe260a68d0066d2", + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2", "shasum": "" }, "require": { @@ -7927,9 +7988,9 @@ ], "support": { "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.21.0" + "source": "https://github.com/FakerPHP/Faker/tree/v1.22.0" }, - "time": "2022-12-13T13:54:32+00:00" + "time": "2023-05-14T12:31:37+00:00" }, { "name": "fidry/cpu-core-counter", @@ -8372,16 +8433,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.15.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", "shasum": "" }, "require": { @@ -8422,9 +8483,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-05-19T20:20:00+00:00" }, { "name": "nunomaduro/collision", @@ -8612,22 +8673,22 @@ }, { "name": "orchestra/testbench", - "version": "v8.5.1", + "version": "v8.5.3", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "636bb5079170f1b49ca754e648712a2b32fa7aef" + "reference": "69d47fba51b5a978d09f856834f3348e84356c91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/636bb5079170f1b49ca754e648712a2b32fa7aef", - "reference": "636bb5079170f1b49ca754e648712a2b32fa7aef", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/69d47fba51b5a978d09f856834f3348e84356c91", + "reference": "69d47fba51b5a978d09f856834f3348e84356c91", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", "fakerphp/faker": "^1.21", - "laravel/framework": ">=10.8.0 <10.10.0", + "laravel/framework": ">=10.8.0 <10.12.0", "mockery/mockery": "^1.5.1", "orchestra/testbench-core": ">=8.5.0 <8.6.0", "php": "^8.1", @@ -8661,22 +8722,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v8.5.1" + "source": "https://github.com/orchestral/testbench/tree/v8.5.3" }, - "time": "2023-04-24T05:40:14+00:00" + "time": "2023-05-16T11:46:44+00:00" }, { "name": "orchestra/testbench-core", - "version": "v8.5.0", + "version": "v8.5.2", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "4d0ed25a83179d8e59487198f619b57b64d4410f" + "reference": "bc3331081bf8d85cc0806187427fce35471df6a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/4d0ed25a83179d8e59487198f619b57b64d4410f", - "reference": "4d0ed25a83179d8e59487198f619b57b64d4410f", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/bc3331081bf8d85cc0806187427fce35471df6a8", + "reference": "bc3331081bf8d85cc0806187427fce35471df6a8", "shasum": "" }, "require": { @@ -8685,7 +8746,7 @@ }, "require-dev": { "fakerphp/faker": "^1.21", - "laravel/framework": "^10.8", + "laravel/framework": "^10.10", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", "orchestra/canvas": "^8.1", @@ -8699,7 +8760,7 @@ "suggest": { "brianium/paratest": "Allow using parallel tresting (^6.4 || ^7.1.4).", "fakerphp/faker": "Allow using Faker for testing (^1.21).", - "laravel/framework": "Required for testing (^10.8).", + "laravel/framework": "Required for testing (^10.10).", "mockery/mockery": "Allow using Mockery for testing (^1.5.1).", "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.4).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).", @@ -8712,11 +8773,6 @@ "testbench" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.0-dev" - } - }, "autoload": { "files": [ "src/helpers.php" @@ -8750,7 +8806,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2023-04-18T14:07:29+00:00" + "time": "2023-05-17T00:13:44+00:00" }, { "name": "pestphp/pest", @@ -9405,16 +9461,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.14", + "version": "1.10.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c" + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", "shasum": "" }, "require": { @@ -9463,7 +9519,7 @@ "type": "tidelift" } ], - "time": "2023-04-19T13:47:27+00:00" + "time": "2023-05-09T15:28:01+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -9885,16 +9941,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.7", + "version": "9.6.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2" + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", - "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", "shasum": "" }, "require": { @@ -9968,7 +10024,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.7" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" }, "funding": [ { @@ -9984,7 +10040,7 @@ "type": "tidelift" } ], - "time": "2023-04-14T08:58:40+00:00" + "time": "2023-05-11T05:14:45+00:00" }, { "name": "pimple/pimple", @@ -10339,16 +10395,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -10393,7 +10449,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -10401,7 +10457,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", @@ -11202,16 +11258,16 @@ }, { "name": "spatie/ray", - "version": "1.37.1", + "version": "1.37.2", "source": { "type": "git", "url": "https://github.com/spatie/ray.git", - "reference": "a915e327f04c0fbed3bdd26e076e39feea091062" + "reference": "dea16182d4bc9d9833adec7e39fbb3d7b553425d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ray/zipball/a915e327f04c0fbed3bdd26e076e39feea091062", - "reference": "a915e327f04c0fbed3bdd26e076e39feea091062", + "url": "https://api.github.com/repos/spatie/ray/zipball/dea16182d4bc9d9833adec7e39fbb3d7b553425d", + "reference": "dea16182d4bc9d9833adec7e39fbb3d7b553425d", "shasum": "" }, "require": { @@ -11262,7 +11318,7 @@ ], "support": { "issues": "https://github.com/spatie/ray/issues", - "source": "https://github.com/spatie/ray/tree/1.37.1" + "source": "https://github.com/spatie/ray/tree/1.37.2" }, "funding": [ { @@ -11274,7 +11330,7 @@ "type": "other" } ], - "time": "2023-03-06T07:22:28+00:00" + "time": "2023-05-17T06:35:47+00:00" }, { "name": "symfony/polyfill-iconv", diff --git a/config/zeus-sky.php b/config/zeus-sky.php index 7c051bd..8c81919 100644 --- a/config/zeus-sky.php +++ b/config/zeus-sky.php @@ -22,6 +22,11 @@ */ 'page_uri_prefix' => 'page', + /** + * set the prefix for library URL. + */ + 'library_uri_prefix' => 'library', + /** * customize the models */ @@ -30,6 +35,7 @@ 'post' => \LaraZeus\Sky\Models\Post::class, 'postStatus' => \LaraZeus\Sky\Models\PostStatus::class, 'tag' => \LaraZeus\Sky\Models\Tag::class, + 'library' => \LaraZeus\Sky\Models\Library::class, ], /** @@ -40,6 +46,7 @@ LaraZeus\Sky\Filament\Resources\PageResource::class, LaraZeus\Sky\Filament\Resources\TagResource::class, LaraZeus\Sky\Filament\Resources\FaqResource::class, + LaraZeus\Sky\Filament\Resources\LibraryResource::class, ], /** @@ -98,4 +105,14 @@ * ex: https://placehold.co/600x400 */ 'default_featured_image' => null, + + /** + * these types help you to render the items in the FE + * set it to null to hide it from the form + */ + 'library_types' => [ + 'FILE' => 'File', + 'IMAGE' => 'Image', + 'VIDEO' => 'Video', + ], ]; diff --git a/database/factories/LibraryFactory.php b/database/factories/LibraryFactory.php new file mode 100644 index 0000000..67784ce --- /dev/null +++ b/database/factories/LibraryFactory.php @@ -0,0 +1,29 @@ + $this->faker->slug(2), + 'title' => $this->faker->word, + 'description' => $this->faker->sentence, + 'type' => $this->faker->randomElements(config('zeus-sky.library_types')), + 'file_path' => 'https://picsum.photos/200/300', + ]; + } +} diff --git a/database/migrations/add_indices_to_posts.php.stub b/database/migrations/add_indices_to_posts.php.stub deleted file mode 100644 index b2ac0ab..0000000 --- a/database/migrations/add_indices_to_posts.php.stub +++ /dev/null @@ -1,18 +0,0 @@ -index('title'); - $table->index('slug'); - $table->index('description'); - $table->fullText('content'); - }); - } -}; diff --git a/database/migrations/create_library_table.php.stub b/database/migrations/create_library_table.php.stub new file mode 100644 index 0000000..6e49398 --- /dev/null +++ b/database/migrations/create_library_table.php.stub @@ -0,0 +1,36 @@ +id(); + $table->string('slug'); + $table->text('title'); + $table->text('description')->nullable(); + $table->string('type')->nullable(); + $table->string('file_path')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('libraries'); + } +}; diff --git a/database/seeders/SkySeeder.php b/database/seeders/SkySeeder.php index d260281..794eb8e 100644 --- a/database/seeders/SkySeeder.php +++ b/database/seeders/SkySeeder.php @@ -20,5 +20,12 @@ public function run() $random_tags = config('zeus-sky.models.tag')::all()->random(1)->first()->name; $post->syncTagsWithType([$random_tags], 'category'); } + + config('zeus-sky.models.tag')::create(['name' => ['en' => 'support docs', 'ar' => 'الدعم الفني'], 'type' => 'library']); + config('zeus-sky.models.tag')::create(['name' => ['en' => 'how to', 'ar' => 'كيف'], 'type' => 'library']); + + config('zeus-sky.models.library')::factory() + ->count(8) + ->create(); } } diff --git a/docs/addons.md b/docs/addons.md index e61863b..713b9c2 100644 --- a/docs/addons.md +++ b/docs/addons.md @@ -14,6 +14,12 @@ to set the url of the FAQ from the `zeus-sky.php` config file: 'faq_uri_prefix' => 'faq', ``` +## Library Addons +to set the url of the Library from the `zeus-sky.php` config file: +```php +'library_uri_prefix' => 'Library', +``` + to disable any resource, remove it from the config: ```php 'enabled_resources' => [ ... ], diff --git a/docs/configuration.md b/docs/configuration.md index 21e8028..1327294 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -38,6 +38,17 @@ return [ */ 'page_uri_prefix' => 'page', + /** + * customize the models + */ + 'models' => [ + 'faq' => \LaraZeus\Sky\Models\Faq::class, + 'post' => \LaraZeus\Sky\Models\Post::class, + 'postStatus' => \LaraZeus\Sky\Models\PostStatus::class, + 'tag' => \LaraZeus\Sky\Models\Tag::class, + 'library' => \LaraZeus\Sky\Models\Library::class, + ], + /** * enable or disable individual Resources. */ @@ -46,6 +57,7 @@ return [ LaraZeus\Sky\Filament\Resources\PageResource::class, LaraZeus\Sky\Filament\Resources\TagResource::class, LaraZeus\Sky\Filament\Resources\FaqResource::class, + LaraZeus\Sky\Filament\Resources\LibraryResource::class, ], /** @@ -88,5 +100,15 @@ return [ * default featured image, set to null to disable it. */ 'default_featured_image' => null, + + /** + * these types help you to render the items in the FE + * set it to null to hide it from the form + */ + 'library_types' => [ + 'FILE' => 'File', + 'IMAGE' => 'Image', + 'VIDEO' => 'Video', + ], ]; ``` diff --git a/resources/views/themes/zeus/addons/library-item.blade.php b/resources/views/themes/zeus/addons/library-item.blade.php new file mode 100644 index 0000000..fe3ed24 --- /dev/null +++ b/resources/views/themes/zeus/addons/library-item.blade.php @@ -0,0 +1,50 @@ +
+ + +

{{ $item->title }}

+
+ + +
  • + {{ __('library') }} + +
  • + +
  • + Viewing {{ $item->title }} +
  • +
    + + +

    {{ $item->title }}

    + +

    + {{ $item->description }} +

    + +

    + {{ __('created at') }}: + {{ $item->created_at->format('Y.m/d') }}-{{ $item->created_at->format('h:i a') }} +

    + + @if($item->type === 'IMAGE') + + @endif + + @if($item->type === 'FILE') +
    + + {{ __('Show File') }} + +
    + @endif + + @if($item->type === 'VIDEO') + + @endif + +
    +
    diff --git a/resources/views/themes/zeus/addons/library.blade.php b/resources/views/themes/zeus/addons/library.blade.php new file mode 100644 index 0000000..e0f4606 --- /dev/null +++ b/resources/views/themes/zeus/addons/library.blade.php @@ -0,0 +1,40 @@ +
    + + +

    {{ __('Libraries') }}

    +
    + +
    + @foreach($categories as $category) + +

    {{ $category->name }}

    + +
    + @endforeach +
    + +
    diff --git a/routes/web.php b/routes/web.php index c1bb80f..47b1ef8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,7 @@ use Illuminate\Support\Facades\Route; use LaraZeus\Sky\Http\Livewire\Faq; +use LaraZeus\Sky\Http\Livewire\Library; use LaraZeus\Sky\Http\Livewire\Page; use LaraZeus\Sky\Http\Livewire\Post; use LaraZeus\Sky\Http\Livewire\Posts; @@ -27,3 +28,13 @@ ->get(config('zeus-sky.faq_uri_prefix'), Faq::class) ->name('faq'); } + +if (in_array('LaraZeus\Sky\Filament\Resources\LibraryResource', config('zeus-sky.enabled_resources'))) { + Route::middleware(config('zeus-sky.middleware')) + ->get(config('zeus-sky.library_uri_prefix'), Library::class) + ->name('library'); + + Route::middleware(config('zeus-sky.middleware')) + ->get(config('zeus-sky.library_uri_prefix').'/{slug}', \LaraZeus\Sky\Http\Livewire\LibraryItem::class) + ->name('library.item'); +} diff --git a/src/Filament/Resources/LibraryResource.php b/src/Filament/Resources/LibraryResource.php new file mode 100644 index 0000000..6cb1a54 --- /dev/null +++ b/src/Filament/Resources/LibraryResource.php @@ -0,0 +1,145 @@ +count(); + } + + public static function form(Form $form): Form + { + return $form + ->schema([ + TextInput::make('title') + ->label(__('Library Title')) + ->required() + ->maxLength(255) + ->reactive() + ->afterStateUpdated(function (Closure $set, $state, $context) { + if ($context === 'edit') { + return; + } + + $set('slug', Str::slug($state)); + }), + + TextInput::make('slug') + ->unique(ignorable: fn(?Model $record): ?Model => $record) + ->required() + ->maxLength(255) + ->label(__('Library Slug')), + + Textarea::make('description') + ->maxLength(255) + ->label(__('Description')) + ->columnSpan(2), + + SpatieTagsInput::make('category') + ->type('library') + ->label(__('Categories')), + + Select::make('type') + ->label(__('Type')) + ->visible(config('zeus-sky.library_types') !== null) + ->options(config('zeus-sky.library_types', null)), + + + Section::make(__('File')) + ->schema([ + Radio::make('upload_or_url') + ->label('') + ->reactive() + ->dehydrated(false) + ->afterStateHydrated(function (Closure $set, Closure $get) { + $setVal = ($get('file_path') === null) ? 'upload' : 'url'; + $set('upload_or_url', $setVal); + }) + ->default('upload') + ->options([ + 'upload' => __('upload'), + 'url' => __('url'), + ]) + ->inline(), + + SpatieMediaLibraryFileUpload::make('file_path_upload') + ->collection('library') + ->visible(fn (Closure $get) => $get('upload_or_url') === 'upload') + ->label(''), + + TextInput::make('file_path') + ->label(__('file url')) + ->visible(fn (Closure $get) => $get('upload_or_url') === 'url') + ->url(), + ]) + ->collapsible(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('title')->label(__('Library Title')), + TextColumn::make('slug')->label(__('Library Slug')), + TextColumn::make('type')->label(__('Library Type')), + + SpatieTagsColumn::make('tags') + ->label(__('Library Tags')) + ->type('library'), + ]) + ->defaultSort('id', 'desc'); + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListLibrary::route('/'), + 'create' => Pages\CreateLibrary::route('/create'), + 'edit' => Pages\EditLibrary::route('/{record}/edit'), + ]; + } + + public static function getLabel(): string + { + return __('Library'); + } + + public static function getPluralLabel(): string + { + return __('Libraries'); + } + + protected static function getNavigationLabel(): string + { + return __('Libraries'); + } +} diff --git a/src/Filament/Resources/LibraryResource/Pages/CreateLibrary.php b/src/Filament/Resources/LibraryResource/Pages/CreateLibrary.php new file mode 100644 index 0000000..56b30c1 --- /dev/null +++ b/src/Filament/Resources/LibraryResource/Pages/CreateLibrary.php @@ -0,0 +1,13 @@ +required() ->maxLength(255) ->reactive() - ->afterStateUpdated(function (Closure $set, $state) { + ->afterStateUpdated(function (Closure $set, $state, $context) { + if ($context === 'edit') { + return; + } + $set('slug', Str::slug($state)); }), diff --git a/src/Http/Livewire/Library.php b/src/Http/Livewire/Library.php new file mode 100644 index 0000000..a353ee9 --- /dev/null +++ b/src/Http/Livewire/Library.php @@ -0,0 +1,25 @@ +title(__('Library')) + ->description(__('Libraries') . ' ' . config('zeus-sky.site_description', 'Laravel')) + ->site(config('zeus-sky.site_title', 'Laravel')) + ->rawTag('favicon', '') + ->rawTag('') + ->withUrl() + ->twitter(); + + return view(app('theme') . '.addons.library') + ->with('libraries', config('zeus-sky.models.library')::get()) + ->with('categories', config('zeus-sky.models.tag')::getWithType('library')) + ->layout(config('zeus-sky.layout')); + } +} diff --git a/src/Http/Livewire/LibraryItem.php b/src/Http/Livewire/LibraryItem.php new file mode 100644 index 0000000..f2af5b9 --- /dev/null +++ b/src/Http/Livewire/LibraryItem.php @@ -0,0 +1,31 @@ +item = config('zeus-sky.models.library')::where('slug', $slug)->firstOrFail(); + } + public function render() + { + seo() + ->title($this->item->title . ' - ' . __('Library')) + ->description($this->item->description . ' ' . config('zeus-sky.site_description', 'Laravel')) + ->site(config('zeus-sky.site_title', 'Laravel')) + ->rawTag('favicon', '') + ->rawTag('') + ->withUrl() + ->twitter(); + + return view(app('theme') . '.addons.library-item') + ->with('library', $this->item) + ->layout(config('zeus-sky.layout')); + } +} diff --git a/src/Models/Library.php b/src/Models/Library.php new file mode 100644 index 0000000..b828116 --- /dev/null +++ b/src/Models/Library.php @@ -0,0 +1,50 @@ +morphedByMany(config('zeus-sky.models.post'), 'taggable'); } + public function library() + { + return $this->morphedByMany(config('zeus-sky.models.library'), 'taggable'); + } + public function postsPublished() { return $this->morphedByMany(config('zeus-sky.models.post'), 'taggable')->published(); diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php index e760d33..1cd7539 100644 --- a/src/SkyServiceProvider.php +++ b/src/SkyServiceProvider.php @@ -50,7 +50,12 @@ protected function getCommands(): array public function packageConfiguring(Package $package): void { $package - ->hasMigrations(['create_posts_table', 'create_faqs_table', 'modify_posts_columns','add_indices_to_posts']) + ->hasMigrations([ + 'create_posts_table', + 'create_faqs_table', + 'modify_posts_columns', + 'create_library_table', + ]) ->hasRoute('web'); } From b09bb713652a7d4548f12fe06e42269bba6a4d95 Mon Sep 17 00:00:00 2001 From: atmonshi Date: Sat, 20 May 2023 17:37:37 +0000 Subject: [PATCH 3/5] Fix styling --- routes/web.php | 2 +- src/Filament/Resources/LibraryResource.php | 5 ++--- src/Http/Livewire/LibraryItem.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/routes/web.php b/routes/web.php index 47b1ef8..5d6dc64 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,6 +35,6 @@ ->name('library'); Route::middleware(config('zeus-sky.middleware')) - ->get(config('zeus-sky.library_uri_prefix').'/{slug}', \LaraZeus\Sky\Http\Livewire\LibraryItem::class) + ->get(config('zeus-sky.library_uri_prefix') . '/{slug}', \LaraZeus\Sky\Http\Livewire\LibraryItem::class) ->name('library.item'); } diff --git a/src/Filament/Resources/LibraryResource.php b/src/Filament/Resources/LibraryResource.php index 6cb1a54..62eef12 100644 --- a/src/Filament/Resources/LibraryResource.php +++ b/src/Filament/Resources/LibraryResource.php @@ -32,7 +32,7 @@ public static function getModel(): string protected static function getNavigationBadge(): ?string { - return (string)config('zeus-sky.models.library')::query()->count(); + return (string) config('zeus-sky.models.library')::query()->count(); } public static function form(Form $form): Form @@ -53,7 +53,7 @@ public static function form(Form $form): Form }), TextInput::make('slug') - ->unique(ignorable: fn(?Model $record): ?Model => $record) + ->unique(ignorable: fn (?Model $record): ?Model => $record) ->required() ->maxLength(255) ->label(__('Library Slug')), @@ -72,7 +72,6 @@ public static function form(Form $form): Form ->visible(config('zeus-sky.library_types') !== null) ->options(config('zeus-sky.library_types', null)), - Section::make(__('File')) ->schema([ Radio::make('upload_or_url') diff --git a/src/Http/Livewire/LibraryItem.php b/src/Http/Livewire/LibraryItem.php index f2af5b9..9f31a8f 100644 --- a/src/Http/Livewire/LibraryItem.php +++ b/src/Http/Livewire/LibraryItem.php @@ -3,7 +3,6 @@ namespace LaraZeus\Sky\Http\Livewire; use Livewire\Component; -use \LaraZeus\Sky\Models\Library as libraryModel; class LibraryItem extends Component { @@ -13,6 +12,7 @@ public function mount($slug) { $this->item = config('zeus-sky.models.library')::where('slug', $slug)->firstOrFail(); } + public function render() { seo() From 9d95a48ed71f7542ed357d9c42c3e6beef0c5deb Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Sat, 20 May 2023 20:41:59 +0300 Subject: [PATCH 4/5] use config model in seeders --- database/seeders/SkySeeder.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/database/seeders/SkySeeder.php b/database/seeders/SkySeeder.php index 794eb8e..254f467 100644 --- a/database/seeders/SkySeeder.php +++ b/database/seeders/SkySeeder.php @@ -3,6 +3,8 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; +use LaraZeus\Sky\Models\Library; +use LaraZeus\Sky\Models\Tag; class SkySeeder extends Seeder { @@ -16,7 +18,7 @@ public function run() ->count(8) ->create(); - foreach (config('zeus-sky.models.post')::all() as $post) { // loop through all posts + foreach (config('zeus-sky.models.post')::all() as $post) { $random_tags = config('zeus-sky.models.tag')::all()->random(1)->first()->name; $post->syncTagsWithType([$random_tags], 'category'); } @@ -27,5 +29,10 @@ public function run() config('zeus-sky.models.library')::factory() ->count(8) ->create(); + + foreach (config('zeus-sky.models.library')::all() as $library) { + $random_tags = config('zeus-sky.models.tag')::getWithType('library')->random(1)->first()->name; + $library->syncTagsWithType([$random_tags], 'library'); + } } } From 6ae9de58106b72ac6efb7e5ec4580d966095d1d8 Mon Sep 17 00:00:00 2001 From: atmonshi Date: Sat, 20 May 2023 17:42:40 +0000 Subject: [PATCH 5/5] Fix styling --- database/seeders/SkySeeder.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/database/seeders/SkySeeder.php b/database/seeders/SkySeeder.php index 254f467..508d267 100644 --- a/database/seeders/SkySeeder.php +++ b/database/seeders/SkySeeder.php @@ -3,8 +3,6 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; -use LaraZeus\Sky\Models\Library; -use LaraZeus\Sky\Models\Tag; class SkySeeder extends Seeder {