File "PerformDataBindingUpdates.php"

Full Path: /home/fundopuh/trader.fxex.org/vendor/livewire/livewire/src/HydrationMiddleware/PerformDataBindingUpdates.php
File size: 913 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Livewire\HydrationMiddleware;

use Livewire\Livewire;
use Illuminate\Validation\ValidationException;

class PerformDataBindingUpdates implements HydrationMiddleware
{
    public static function hydrate($unHydratedInstance, $request)
    {
        try {
            foreach ($request->updates as $update) {
                if ($update['type'] !== 'syncInput') continue;

                $data = $update['payload'];
                
                if (! array_key_exists('value', $data)) continue;

                $unHydratedInstance->syncInput($data['name'], $data['value']);
            }
        } catch (ValidationException $e) {
            Livewire::dispatch('failed-validation', $e->validator, $unHydratedInstance);

            $unHydratedInstance->setErrorBag($e->validator->errors());
        }
    }

    public static function dehydrate($instance, $response)
    {
        //
    }
}