I have two sites site1.dev and site2.dev pointing to the same application. What I want is connect site1.dev to one database (db1) and site2.dev to other(db2) and sync db1 to db2 . well I found out that using more than two databases is possible , but what I actually want is syncing all activites of db1 to db2 . I have also created a logs table for recording activites for create, edit and delete. This is the schema of the table
Schema::create('sync_logs', function (Blueprint $table) {
$table->increments('id');
$table->integer('model_id')->nullable()->default(null);
$table->string('model')->nullable()->default(null);
$table->integer('action')->comment('0=>Create, 1=>Update, 2=>Delete');
$table->text('data');
$table->boolean('synced')->default(0);
$table->timestamps();
});
I am planning to retrieve all the unsynced data and insert the data to db2 in loop. Is this possible ? What are the ways to do that ?