When you say realtime? Do you mean without a page refresh? If so, you will need some front end scripting like Vue, to create server calls to fetch the new data. Or you might consider using Laravel Livewire - https://laravel-livewire.com/
May 13, 2020
7
Level 1
Update query to show table in real time
Greetings!
I hope I can explain myself properly.
I have a table in my view that shows all rows in my db like this:
Query used to make this table:
$query= DB::connection('pgsql')->table('DATOS_CABECERA_OT')->get();
+-------+---------+----------------+
| form | taller | id_antiguedad |
+-------+---------+----------------+
| 1 | A1 | 2020 |
| 2 | A2 | 2020 |
| 3 | A3 | 2019 |
| 4 | A1 | 2019 |
| 5 | A2 | 2019 |
| 6 | A3 | 2018 |
| 7 | B1 | 2018 |
| 8 | B2 | 2017 |
| 9 | B1 | 2017 |
Now, I need a button in my view to update the query to show specific rows using where statements, like this querys:
$query = DB::connection('pgsql')->table('DATOS_CABECERA_OT')->where('taller','A1')->get();
$query = DB::connection('pgsql')->table('DATOS_CABECERA_OT')->where('taller','B1')->where('id_antiguedad','2018')->get();
$query = DB::connection('pgsql')->table('DATOS_CABECERA_OT')->where('taller','A2')->where('id_antiguedad','2020')->get();
That button must update the rows retrieved from db and show all the new info in the same table, in real time. I also have this combo box:
<select class="form-control ml-3" id="id_antiguedad" name="id_antiguedad">
<option value="" >ALL</option>
<option value="2020" >2020</option>
<option value="2019" >2019</option>
<option value="2018" >2018</option>
<option value="2017" >2017</option>
</select>
This combo box makes a filter to the table. I need to update the table in the view in real time. Please help!
Please or to participate in this conversation.