Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit f473d52

Browse files
Refactor store_user_settings operation: integrate WithVendor, WithFilaments, and WithColor traits; remove deprecated methods and attributes.
1 parent f4f6c9a commit f473d52

File tree

1 file changed

+7
-36
lines changed

1 file changed

+7
-36
lines changed

operations/2026_01_02_195202_store_user_settings.php

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
declare(strict_types=1);
44

5+
use App\Concerns\WithColor;
6+
use App\Concerns\WithFilaments;
7+
use App\Concerns\WithVendor;
58
use App\Models\Color;
69
use App\Models\Filament;
7-
use App\Models\FilamentType;
810
use App\Models\Machine;
911
use App\Models\User;
10-
use App\Models\Vendor;
1112
use DragonCode\LaravelDeployOperations\Operation;
1213

1314
return new class extends Operation {
15+
use WithVendor;
16+
use WithFilaments;
17+
use WithColor;
18+
1419
protected array $items = [
1520
[
1621
'vendor' => 'Bambulab',
@@ -172,12 +177,6 @@
172177

173178
protected ?Machine $machine;
174179

175-
protected array $filaments = [];
176-
177-
protected array $filamentTypes = [];
178-
179-
protected array $vendors = [];
180-
181180
protected array $colors = [];
182181

183182
public function __invoke(): void
@@ -226,32 +225,4 @@ protected function machine(): Machine
226225
{
227226
return $this->machine ??= Machine::firstWhere('slug', 'k1-max');
228227
}
229-
230-
protected function vendor(string $name): Vendor
231-
{
232-
return $this->vendors[$name] ??= Vendor::firstOrCreate(['title' => $name]);
233-
}
234-
235-
protected function filament(Vendor $vendor, FilamentType $type): Filament
236-
{
237-
$key = $vendor->id . '-' . $type->id;
238-
239-
return $this->filaments[$key] ??= Filament::firstOrCreate([
240-
'vendor_id' => $vendor->id,
241-
'filament_type_id' => $type->id,
242-
], [
243-
'external_id' => $key,
244-
'title' => $vendor->title . ' ' . $type->title,
245-
]);
246-
}
247-
248-
protected function filamentType(string $name): FilamentType
249-
{
250-
return $this->filamentTypes[$name] ??= FilamentType::firstOrCreate(['title' => $name]);
251-
}
252-
253-
protected function color(string $name): Color
254-
{
255-
return $this->colors[$name] ??= Color::firstWhere('title', $name);
256-
}
257228
};

0 commit comments

Comments
 (0)