Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ActivityMonitorController extends Controller
{
public function MonitoringOn()
{
DB::update("UPDATE Config SET [Value] = 'On' WHERE [Key] = 'SystemState'");
DB::insert('INSERT INTO EventLog (Level, Source, Information) values(\'Information\', \'Application\', \'System is ON.\')',);
}
public function MonitoringOff()
{
DB::update("UPDATE Config SET [Value] = 'Off' WHERE [Key] = 'SystemState'");
DB::insert('INSERT INTO EventLog (Level, Source, Information) values(\'Warning\', \'Application\', \'System is OFF.\')',);
}
public function PingSystem()
{
$data = DB::selectOne("SELECT [Value] FROM Config WHERE [Key] = 'SystemState'");
if ($data->Value == 'On')
{
DB::insert("INSERT INTO EventLog (Level, Source, Information) VALUES('Information', 'System', 'Monitoring is active.')");
}
}
}