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;
use Illuminate\Pagination\Paginator;
use Illuminate\Pagination\LengthAwarePaginator;// as Paginator;
class EventLogController extends Controller
{
// public function WriteEvent()
// {
// DB::insert('INSERT INTO EventLog (Level, Source, Information) values(\'Information\', \'System\', \'System is active.\')',);
// }
public function GetItems()
{
$current_page = LengthAwarePaginator::resolveCurrentPage();
$per_page = 10;
$data = DB::select('SELECT * FROM EventLog ORDER BY Id DESC');
$items = collect($data);
$result = new LengthAwarePaginator($items->forPage($current_page, $per_page), $items->count(), $per_page, $current_page, ['path' => url('/events')]);
return view('events_list', ['events' => $result]);
}
}