pelican-panel-mirror/app/Livewire/EndpointSynth.php
2024-06-18 10:59:50 -04:00

31 lines
561 B
PHP

<?php
namespace App\Livewire;
use App\Models\Objects\Endpoint;
use Livewire\Mechanisms\HandleComponents\Synthesizers\Synth;
class EndpointSynth extends Synth
{
public static $key = 'endpoint';
public static function match($target)
{
return $target instanceof Endpoint;
}
public function dehydrate($target)
{
return (string) $target;
}
public function hydrate($value)
{
if (!is_string($value) && !is_int($value)) {
return null;
}
return new Endpoint($value);
}
}