45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
class Kernel extends ConsoleKernel
|
|
{
|
|
/**
|
|
* Define the application's command schedule.
|
|
*/
|
|
protected function schedule(Schedule $schedule): void
|
|
{
|
|
// $schedule->command('inspire')->hourly();
|
|
|
|
// Ambil gambar dari ESP32-CAM setiap 15 menit
|
|
// Catatan: Ganti IP address dengan IP ESP32-CAM Anda
|
|
$schedule->command('esp32cam:fetch 192.168.240.201')
|
|
->everyFifteenMinutes()
|
|
->runInBackground()
|
|
->appendOutputTo(storage_path('logs/esp32cam.log'));
|
|
|
|
// Membersihkan foto lama setiap hari pada jam 1 pagi
|
|
$schedule->command('esp32cam:cleanup')
|
|
->dailyAt('01:00')
|
|
->appendOutputTo(storage_path('logs/esp32cam-cleanup.log'));
|
|
|
|
// Sinkronisasi data Firebase ke history setiap menit
|
|
$schedule->call(function () {
|
|
app(\App\Http\Controllers\HistoryController::class)->syncFromFirebase();
|
|
})->everyMinute();
|
|
}
|
|
|
|
/**
|
|
* Register the commands for the application.
|
|
*/
|
|
protected function commands(): void
|
|
{
|
|
$this->load(__DIR__.'/Commands');
|
|
|
|
require base_path('routes/console.php');
|
|
}
|
|
}
|