如何在URL中附加1个以上的可选查询参数,然后根据这2个参数获取记录?

Currently my simple filter allows me to get the images either in ascending or descending order. Now I'm trying to make it so I can get the images from today/this week/this month in ascending or descending order AKA apply the 2 filters simultaneously.

The problem is that I can't get the second query parameter to stick at the end of the URL. When I'm on www.example.com and click the ascending <a> element my URL becomes www.example.com/?order=asc. Then when I click the today <a> element my URL becomes www.example.com/?time=today but I want it to become www.example.com/?order=asc?time=today so then I can get the time through my request.

I'm also not sure how exactly would my query look like when trying to combine these 2 filters which are optimal and might not even be present in the URL but I guess I'll figure that out once I'm actually able to append both the filters to my URL.

HTML

<ul class='home-filters'>
    <div class="wrapper">
        <li><a class='placeholderA' href='/'>Descending</a></li>
        <li><a class='placeholderA' href='?order=asc'>Ascending</a></li>
        <li><a class='placeholderA' href='/?time=today'>Today</a></li>
        <li><a class='placeholderA' href='?time=week'>This Week</a></li>
        <li><a class='placeholderA' href='?time=month'>This Month</a></li>
    </div>
</ul>

PagesController

public function index(Request $request){
        $images = Image::orderBy('created_at', $request->get('order') ?? 'desc')->get();

        return view('home', ['images' => $images]);
    }

First of all direct children of ul tags should be li tags.

What you are trying to do can be easily accomplish by just using a form like the following.

<form action="url" method="GET">
    <input type="radio" name="order" value="asc" checked>Asceding
    <input type="radio" name="order" value="desc">Descending
    <input type="radio" name="time" value="any" checked>Anytime
    <input type="radio" name="time" value="today">Today
    <input type="radio" name="time" value="week">This week
    <input type="radio" name="time" value="month">This month
    <button>
        Submit
    </button>
</form>

You can set the request URL instead for the href values, and then scan and filter optional query parameters in controller.

Reference