bobington's avatar

Keep checked box from one page to another with Laravel Pagination

hi,

I was wondering if you could store what checkbox are checked between the page with laravel?

my controller:

public function index()
    {
        $values = DB::table('mytable')->limit(10)
            ->paginate(50);
        
        return view('index', compact('values'));
    }

my html:


<form action="/test"  method="POST"> 
<button class="btn" name="submit" value="XLSX"  type="submit">Exp(XLSX)</button>
<button class="btn" name="submit" value="XLS"  type="submit">Exp(XLS)</button>
<input name="value[]" type="hidden" value="0">

<tbody>

                    @foreach($values as $value)
                    {!! csrf_field() !!}
                    
                    <tr>

                        <td><input name="valeur[]" type="checkbox"
                                value="{{$value->id}}">{{$value->id}}</td>
                    </tr>
</tbody>
0 likes
2 replies
Heyaj05's avatar
Heyaj05
Best Answer
Level 4

You can store them in session or create storage keys the other thing you can do is pass them in the url as parameters.

Please or to participate in this conversation.