In Laravel, I have a table of articles which I pulled from a database at the start of my project over a month ago.
This database is separate from my Laravel application but the content may change daily and I've been manually grabbing the content every three days, which as you can imagine takes time.
I've seen that you can have two database connects in Laravel, like so:
<?php
return array(
'default' => 'mysql',
'connections' => array(
# Our primary database connection
'mysql' => array(
'driver' => 'mysql',
'host' => 'host1',
'database' => 'database1',
'username' => 'user1',
'password' => 'pass1'
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
# Our secondary database connection
'mysql2' => array(
'driver' => 'mysql',
'host' => 'host2',
'database' => 'database2',
'username' => 'user2',
'password' => 'pass2'
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
);
So, If I have my secondary article table that I can connect to is it possible to create a cron job that pulls in new content to my Laravel application every hour?
When pulling from the secondary database, how could I avoid overwriting content?