Build Laravel 13 ticket assistant with Docker, Livewire admin, and helpdesk scraper command

This commit is contained in:
SitiWeb
2026-04-29 13:11:39 +02:00
parent 141a1a3c9b
commit 3c4572bb12
58 changed files with 9377 additions and 455 deletions

36
app/Casts/VectorCast.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class VectorCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes): ?array
{
if ($value === null) {
return null;
}
if (is_array($value)) {
return $value;
}
$trimmed = trim((string) $value, '[]');
if ($trimmed === '') {
return [];
}
return array_map(static fn ($item) => (float) $item, explode(',', $trimmed));
}
public function set($model, string $key, $value, array $attributes): ?string
{
if ($value === null) {
return null;
}
$vector = array_map(static fn ($item) => (float) $item, $value);
return '['.implode(',', $vector).']';
}
}