#127 Implement Resource Lock
This commit is contained in:
parent
63d5f427ad
commit
86e48f8e16
@ -21,9 +21,12 @@
|
|||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Kenepa\ResourceLock\Resources\Pages\Concerns\UsesResourceLock;
|
||||||
|
|
||||||
class EditOrder extends EditRecord
|
class EditOrder extends EditRecord
|
||||||
{
|
{
|
||||||
|
use UsesResourceLock;
|
||||||
|
|
||||||
protected static string $resource = OrderResource::class;
|
protected static string $resource = OrderResource::class;
|
||||||
|
|
||||||
public function getTitle(): string|Htmlable
|
public function getTitle(): string|Htmlable
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Kenepa\ResourceLock\Models\Concerns\HasLocks;
|
||||||
|
|
||||||
#[ObservedBy(OrderObserver::class)]
|
#[ObservedBy(OrderObserver::class)]
|
||||||
|
|
||||||
class Order extends Model
|
class Order extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<OrderFactory> */
|
/** @use HasFactory<OrderFactory> */
|
||||||
use HasFactory, SoftDeletes;
|
use HasFactory, SoftDeletes, HasLocks;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'customer_id',
|
'customer_id',
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
use Kenepa\ResourceLock\ResourceLockPlugin;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
@ -62,6 +63,7 @@ public function panel(Panel $panel): Panel
|
|||||||
NavigationGroup::make('Financial'),
|
NavigationGroup::make('Financial'),
|
||||||
NavigationGroup::make('Reports'),
|
NavigationGroup::make('Reports'),
|
||||||
NavigationGroup::make('Settings'),
|
NavigationGroup::make('Settings'),
|
||||||
]);
|
])
|
||||||
|
->plugin(ResourceLockPlugin::make());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,16 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
"davidhsianturi/blade-bootstrap-icons": "^1.5",
|
"davidhsianturi/blade-bootstrap-icons": "^1.5",
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
"filament/filament": "^3.2",
|
"filament/filament": "^3.2",
|
||||||
"guava/filament-clusters": "^1.4",
|
"guava/filament-clusters": "^1.4",
|
||||||
"icetalker/filament-table-repeater": "^1.3",
|
"icetalker/filament-table-repeater": "^1.3",
|
||||||
|
"kenepa/resource-lock": "^2.1",
|
||||||
"laravel/framework": "^11.9",
|
"laravel/framework": "^11.9",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
"livewire/livewire": "^3.5",
|
"livewire/livewire": "^3.5",
|
||||||
"mallardduck/blade-lucide-icons": "^1.23",
|
"mallardduck/blade-lucide-icons": "^1.23",
|
||||||
"spatie/laravel-pdf": "^1.5",
|
"spatie/laravel-pdf": "^1.5"
|
||||||
"fakerphp/faker": "^1.23"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-ide-helper": "^3.5",
|
"barryvdh/laravel-ide-helper": "^3.5",
|
||||||
|
74
composer.lock
generated
74
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "46ac06345fc3d57a7d0a01cfcaeaac17",
|
"content-hash": "8b981a2679ca20ca011a3c8b0c38ec22",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anourvalar/eloquent-serialize",
|
"name": "anourvalar/eloquent-serialize",
|
||||||
@ -2238,6 +2238,74 @@
|
|||||||
],
|
],
|
||||||
"time": "2025-03-05T16:06:45+00:00"
|
"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",
|
"name": "kirschbaum-development/eloquent-power-joins",
|
||||||
"version": "4.2.1",
|
"version": "4.2.1",
|
||||||
@ -11705,12 +11773,12 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {},
|
"stability-flags": [],
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"platform-dev": {},
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('resource_locks', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->foreignId('user_id')->constrained();
|
||||||
|
$table->morphs('lockable');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('resource_locks');
|
||||||
|
}
|
||||||
|
};
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "topnotch_website",
|
"name": "order_system",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user