You could make use of one of the various analytics services.. this is exactly what they do. For example, you could push custom events to google analytics, or mix panel.. Would be more performant than handling it in-house.
Generating performance data and storing in database best practices
Good evening,
I was wondering, what is the best way to store website performance data? Like, booked appointments, daily income, expenses, etc.
So for example I have table booking app.
this is my migration
$table->increments('id');
$table->datetime('start');
$table->datetime('end');
$table->boolean('assistant_status')->nullable();
$table->integer('table_id')->unsigned();
$table->foreign('table_id')->references('id')->on('tables');
$table->integer('owner_id')->unsigned();
$table->foreign('owner_id')->references('id')->on('restaurant');
$table->integer('booker_id')->unsigned();
$table->foreign('booker_id')->references('id')->on('users');
$table->softDeletes();
$table->timestamps();
So and I want to generate this week report (not past week, but current week daily report Monday, Tuesday, Wednesday, ... etc ) Because people are booking up front!
So I want to store, this data in for example performance table
$table->increments('id');
$table->integer('owner_id')->unsigned();
$table->foreign('owner_id')->references('id')->on('restaurant');
$table->date('report_date');
$table->integer('need_assistant'); //stores how many reservations in current week's days needs assistants
//Example Today is Monday and restaurant can see how many users will need assistance on Monday, Tuesday, Thursday... etc.
$table->integer('do_not_need_assistant'); //stores how many reservations did not needed assistants for their table's
$table->integer('total_reservations'); //stores total reservations
//Example Today is Monday and restaurant can see how many reservations there are and will be this week - on Monday, on Tuesday, on Thursday... etc till end of week.
$table->timestamps();
So question is, how to generate this data?
With past data it is easy, because it will not change.
But how can I generate data for future and if exists update existing data daily?
Thanks!
Please or to participate in this conversation.