-10

How can I refresh a page when a database is updated in Laravel?

2 Answers2

1

Thats a rough...open ended question. But here's a stab at it.

Often - the client makes requests to the server to receive state information. Often its referred to as "client-server architecture" (somewhat erroneously imo).

E.g - Timmy refreshes his webpage and sees different content because the content has changed since the last time he made a request to the server.

Typically - when you want to have a server-client (again...not entirely accurate use of the term) style of communication it requires you to have a socket open with that client. Seeing how you mentioned Laravel, see: https://laracasts.com/discuss/channels/general-discussion/step-by-step-guide-to-installing-socketio-and-broadcasting-events-with-laravel-51

Socket libraries often have an "event emitting/broadcasting" behavior. This would allow you to achieve something like notifying a given client that something has changed in your database :)

Other resources:

Does anybody still use Client Server Architecture

http://www.tutorialspoint.com/unix_sockets/what_is_socket.htm

What is the difference between a web application and a client/server application?

Community
  • 1
  • 1
The Dembinski
  • 1,469
  • 1
  • 15
  • 24
0

Not 100% sure what you need but you probably should to go with Javascript - using AJAX to monitor your tables with certain intervals, and the reload the page when your criteria is met.

Christoffer
  • 7,470
  • 9
  • 39
  • 55