Forms

This example illustrates an asynchronous form that is processed in the background instead of refreshing the entire page.
namespace App\Http\Controllers;

class FormController extends Controller
{
    public function __construct(AsyncResponse $response)
    {
        $this->response = $response;
    }

    public function registration()
    {
        ...

        if ($error) {
            $this->response->bigPipe()->require("require('Toastr').error()", [
                $error,
            ]);

            return $this->response->send();
        }

        ...

        return $this->response->send();
    }
}

Example

  • Form Validation

    This form is sent asynchronously, if the backend detects invalid data in the form, it will display them via toast.

Github