Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ella-stinnes's avatar

Livewire 3 - Validate queryString

I'm looking to validate the sortField and sortDirection in the queryString.

For example sortDirection should only contain 'asc' or 'desc', if the URL is tampered with then the sortDirection should default to 'asc'.

I'm not sure on the conventional way to validate the queryString?

protected function queryString()
{
    return [
        'sortField'         => ['as' => 'f'],
        'sortDirection'     => ['as' => 'd']];
}
0 likes
0 replies

Please or to participate in this conversation.