Home>

Hello everyone.
I use laravel, I want to make the display of products on the site in a list and bricks.
2pcs type= "radio"

do I understand correctly (what I need to do):

  • i need to add id to each input
  • and somehow through js write for each input action
  • by clicking, we send to the server and record in cookies, etc.

and would not like to shine here form + action

and how to do it (write somehow through js for each input action). thank you all in advance.

  • Answer # 1

    If you want to switch between modes instantly, then without js there is no way, I think to try to do it through livewire. If without js, then I would pass some variable to the controller, for example:

    $displayType= $request->get('displayType', 'brick');
    return view("page.$displayType", [
            'models'=> $models,
    ])
    
  • Answer # 2

    If you want to switch between modes instantly, then without js there is no way, I think to try to do it through livewire. If without js, then I would pass some variable to the controller, for example:

    $displayType= $request->get('displayType', 'brick');
    return view("page.$displayType", [
            'models'=> $models,
    ])