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

Commit 89ed3c4

Browse files
Remove FilamentTitleCast, clean up related logic, adjust models, migrations, services, and update UI for consistency.
1 parent c7caf33 commit 89ed3c4

File tree

7 files changed

+31
-74
lines changed

7 files changed

+31
-74
lines changed

app/Casts/FilamentTitleCast.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/Console/Commands/OrcaSlicerCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class OrcaSlicerCommand extends Command
1616

1717
public function handle(DownloadService $download, ImportService $import): void
1818
{
19-
$this->components->task('Clean up', fn () => $download->cleanup());
20-
$this->components->task('Download', fn () => $download->download());
21-
$this->components->task('Extract', fn () => $download->extract());
22-
$this->components->task('Release', fn () => $download->release());
19+
//$this->components->task('Clean up', fn () => $download->cleanup());
20+
//$this->components->task('Download', fn () => $download->download());
21+
//$this->components->task('Extract', fn () => $download->extract());
22+
//$this->components->task('Release', fn () => $download->release());
2323
$this->components->task('Import profiles', fn () => $import->profiles());
2424
}
2525
}

app/Http/Controllers/HomeController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ class HomeController
1212
public function __invoke()
1313
{
1414
$settings = UserFilament::query()
15-
->with(['machine.vendor', 'filament', 'color'])
15+
->with([
16+
'machine.vendor',
17+
'filament' => ['vendor', 'type'],
18+
'color',
19+
])
1620
->orderBy('machine_id')
1721
->orderBy('filament_id')
22+
->orderBy('color_id')
1823
->orderBy('id')
1924
->get();
2025

app/Models/Filament.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace App\Models;
66

7-
use App\Casts\FilamentTitleCast;
87
use Illuminate\Database\Eloquent\Factories\HasFactory;
98
use Illuminate\Database\Eloquent\Model;
109
use Illuminate\Database\Eloquent\Relations\Relation;
@@ -17,25 +16,15 @@ class Filament extends Model
1716
protected $fillable = [
1817
'vendor_id',
1918
'filament_type_id',
20-
'external_id',
21-
22-
'title',
2319
];
2420

25-
protected function casts(): array
26-
{
27-
return [
28-
'title' => FilamentTitleCast::class,
29-
];
30-
}
31-
3221
public function vendor(): Relation
3322
{
3423
return $this->belongsTo(Vendor::class);
3524
}
3625

3726
public function type(): Relation
3827
{
39-
return $this->belongsTo(FilamentType::class);
28+
return $this->belongsTo(FilamentType::class, 'filament_type_id', 'id');
4029
}
4130
}

app/Services/OrcaSlicer/ImportService.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Illuminate\Support\Str;
2323
use SplFileInfo;
2424

25-
use function array_merge;
2625
use function config;
2726
use function file_get_contents;
2827
use function in_array;
@@ -86,8 +85,8 @@ protected function filaments(Vendor $vendor, Collection $items): void
8685
$type = $this->filamentType($filament->title);
8786

8887
$model = $vendor->filaments()->updateOrCreate([
89-
'external_id' => $filament->settingId,
90-
], array_merge($filament->toArray(), ['filament_type_id' => $type->id]));
88+
'filament_type_id' => $type->id,
89+
], $filament->toArray());
9190

9291
// TODO: Добавить
9392
//$machine = $this->machine($filament->title);

database/migrations/2026_01_01_164559_create_filaments_table.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ public function up(): void
1515
$table->foreignId('vendor_id')->constrained('vendors')->restrictOnDelete();
1616
$table->foreignId('filament_type_id')->constrained('filament_types')->restrictOnDelete();
1717

18-
$table->string('external_id');
19-
20-
$table->string('title');
21-
2218
$table->timestamps();
2319
$table->softDeletes();
2420

25-
$table->unique(['vendor_id', 'external_id']);
21+
$table->unique(['vendor_id', 'filament_type_id']);
2622
});
2723
}
2824
};

resources/js/pages/welcome.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,56 @@ export default function Welcome({ settings }) {
77
<div className="flex min-h-screen flex-col items-center bg-[#EDEDFC] p-6 text-[#1b1b18] lg:justify-center lg:p-8 dark:bg-[#0a0a0a]">
88
<div className="flex w-full items-center justify-center opacity-100 transition-opacity duration-750 lg:grow starting:opacity-0">
99
<main className="flex w-full flex-col-reverse lg:max-w-4xl lg:flex-row">
10-
<table class="w-full border-collapse border border-gray-400 bg-white text-sm dark:border-gray-500 dark:bg-gray-800">
10+
<table className="w-full border-collapse border border-gray-400 bg-white text-sm dark:border-gray-500 dark:bg-gray-800">
1111
<thead>
1212
<tr>
13-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
13+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
1414
Printer
1515
</th>
16-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
16+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
1717
Filament
1818
</th>
19-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
19+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
2020
Color
2121
</th>
22-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
22+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
2323
Pressure Advance
2424
</th>
25-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
25+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
2626
Flow Ratio
2727
</th>
28-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
28+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
2929
Max Volumetric Speed
3030
</th>
31-
<th class="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
31+
<th className="border border-gray-300 p-3 text-left font-semibold text-gray-900 dark:border-gray-600 dark:text-gray-200">
3232
Nozzle Temperature
3333
</th>
3434
</tr>
3535
</thead>
3636
<tbody>
3737
{ settings.map((setting) => (
3838
<tr key={ setting.id }>
39-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
39+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
4040
{ setting.machine.vendor.title }&nbsp;
4141
{ setting.machine.title }
4242
</td>
43-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
44-
{ setting.filament.title }
43+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
44+
{ setting.filament.vendor.title }&nbsp;
45+
{ setting.filament.type.title }<br />
4546
</td>
46-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
47+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
4748
{ setting.color.title }
4849
</td>
49-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
50+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
5051
{ setting.pressure_advance }
5152
</td>
52-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
53+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
5354
{ setting.filament_flow_ratio }
5455
</td>
55-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
56+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
5657
{ setting.filament_max_volumetric_speed }
5758
</td>
58-
<td class="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
59+
<td className="border border-gray-300 p-3 text-left text-gray-900 dark:border-gray-600 dark:text-gray-200">
5960
{ setting.nozzle_temperature }
6061
</td>
6162
</tr>

0 commit comments

Comments
 (0)