intial commit

This commit is contained in:
2026-06-07 19:10:00 +07:00
commit 37bf240d23
230 changed files with 37141 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\StatistikAnak;
use App\Models\Anak;
use Carbon\Carbon;
class DeleteAnak extends Command
{
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
protected $signature = 'anak:delete';
protected $description = 'Delete anak yang umurnya 59 bulan keatas.';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$fiveNineMonthsAgo = Carbon::now()->subMonths(59)->format('Y-m-d');
$anakToDelete = Anak::whereDate('tanggal_lahir', '<=', $fiveNineMonthsAgo)->get();
foreach ($anakToDelete as $anak) {
StatistikAnak::where('id_anak', $anak->id)->delete();
$anak->delete();
}
$this->info('Users deleted successfully.');
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class DeleteUsers extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return 0;
}
}
+33
View File
@@ -0,0 +1,33 @@
<?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.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
// $schedule->command('anak:delete')->dailyAt('00:00')->timezone('Asia/Jakarta');;
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}