diff --git a/app/Filament/Admin/Resources/OrderResource/Pages/EditOrder.php b/app/Filament/Admin/Resources/OrderResource/Pages/EditOrder.php index 7ad745e..70775fa 100644 --- a/app/Filament/Admin/Resources/OrderResource/Pages/EditOrder.php +++ b/app/Filament/Admin/Resources/OrderResource/Pages/EditOrder.php @@ -21,9 +21,12 @@ use Filament\Resources\Pages\EditRecord; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Database\Eloquent\Model; +use Kenepa\ResourceLock\Resources\Pages\Concerns\UsesResourceLock; class EditOrder extends EditRecord { + use UsesResourceLock; + protected static string $resource = OrderResource::class; public function getTitle(): string|Htmlable diff --git a/app/Models/Order.php b/app/Models/Order.php index ee7741f..363d914 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -16,13 +16,14 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Carbon; +use Kenepa\ResourceLock\Models\Concerns\HasLocks; #[ObservedBy(OrderObserver::class)] class Order extends Model { /** @use HasFactory */ - use HasFactory, SoftDeletes; + use HasFactory, SoftDeletes, HasLocks; protected $fillable = [ 'customer_id', diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 3cb54b3..3429770 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -18,6 +18,7 @@ use Illuminate\Session\Middleware\AuthenticateSession; use Illuminate\Session\Middleware\StartSession; use Illuminate\View\Middleware\ShareErrorsFromSession; +use Kenepa\ResourceLock\ResourceLockPlugin; class AdminPanelProvider extends PanelProvider { @@ -62,6 +63,7 @@ public function panel(Panel $panel): Panel NavigationGroup::make('Financial'), NavigationGroup::make('Reports'), NavigationGroup::make('Settings'), - ]); + ]) + ->plugin(ResourceLockPlugin::make()); } } diff --git a/composer.json b/composer.json index 03bd614..b8afb6c 100644 --- a/composer.json +++ b/composer.json @@ -7,15 +7,16 @@ "require": { "php": "^8.2", "davidhsianturi/blade-bootstrap-icons": "^1.5", + "fakerphp/faker": "^1.23", "filament/filament": "^3.2", "guava/filament-clusters": "^1.4", "icetalker/filament-table-repeater": "^1.3", + "kenepa/resource-lock": "^2.1", "laravel/framework": "^11.9", "laravel/tinker": "^2.9", "livewire/livewire": "^3.5", "mallardduck/blade-lucide-icons": "^1.23", - "spatie/laravel-pdf": "^1.5", - "fakerphp/faker": "^1.23" + "spatie/laravel-pdf": "^1.5" }, "require-dev": { "barryvdh/laravel-ide-helper": "^3.5", diff --git a/composer.lock b/composer.lock index 427fea6..624609f 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": "46ac06345fc3d57a7d0a01cfcaeaac17", + "content-hash": "8b981a2679ca20ca011a3c8b0c38ec22", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -2238,6 +2238,74 @@ ], "time": "2025-03-05T16:06:45+00:00" }, + { + "name": "kenepa/resource-lock", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/kenepa/resource-lock.git", + "reference": "dda6e14b5c4a47817569081b11248c572ebdfd07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kenepa/resource-lock/zipball/dda6e14b5c4a47817569081b11248c572ebdfd07", + "reference": "dda6e14b5c4a47817569081b11248c572ebdfd07", + "shasum": "" + }, + "require": { + "filament/filament": "^3.0", + "illuminate/contracts": "^9.0|^10.0|^11.0|^12.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.15.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.0|^8.1", + "nunomaduro/larastan": "^2.0.1", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "pestphp/pest": "^2.0|^3.7", + "pestphp/pest-plugin-laravel": "^2.0|^3.1", + "pestphp/pest-plugin-livewire": "^2.0|^3.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0|^2.0", + "phpstan/phpstan-phpunit": "^1.0|^2.0", + "spatie/laravel-ray": "^1.26", + "tightenco/duster": "^1.1|^3.1" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "ResourceLock": "Kenepa\\ResourceLock\\Facades\\ResourceLock" + }, + "providers": [ + "Kenepa\\ResourceLock\\ResourceLockServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Kenepa\\ResourceLock\\": "src", + "Kenepa\\ResourceLock\\Database\\Factories\\": "database/factories" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Filament Resource Lock is a Filament plugin that adds resource locking functionality to your site.", + "homepage": "https://github.com/kenepa/resource-lock", + "keywords": [ + "Kenepa", + "laravel", + "resource-lock" + ], + "support": { + "issues": "https://github.com/kenepa/resource-lock/issues", + "source": "https://github.com/kenepa/resource-lock/tree/2.1.3" + }, + "time": "2025-03-14T16:31:20+00:00" + }, { "name": "kirschbaum-development/eloquent-power-joins", "version": "4.2.1", @@ -11705,12 +11773,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.2" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/database/migrations/2025_04_03_194923_create_resource_lock_table.php b/database/migrations/2025_04_03_194923_create_resource_lock_table.php new file mode 100644 index 0000000..def48ec --- /dev/null +++ b/database/migrations/2025_04_03_194923_create_resource_lock_table.php @@ -0,0 +1,29 @@ +id(); + $table->timestamps(); + $table->foreignId('user_id')->constrained(); + $table->morphs('lockable'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('resource_locks'); + } +}; diff --git a/package-lock.json b/package-lock.json index 431400d..41ab04a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "topnotch_website", + "name": "order_system", "lockfileVersion": 3, "requires": true, "packages": {