добавляю все изменения проекта на текущий момент

This commit is contained in:
vasya
2026-02-27 18:49:27 +03:00
parent e927910fda
commit 9c35f4e35e
303 changed files with 79434 additions and 2558 deletions
@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
/**
* Базовый класс для описания команд по расписанию
* Создан, в частности, чтобы предоставить универсальный функционал для всех команд, запускаемых по расписанию
*/
abstract class BaseScheduleCommand extends Command
{
/**
* Метод выполнения команды
*
* @param callable $execFunc функция с логикой выполнения команды
* @return void
*/
protected function executeCommand(callable $execFunc): void
{
try {
$execFunc();
} catch (\Throwable $th) {
$this->logExecErr($th);
}
}
/**
* Метод логирования ошибки выполнения скриптов по расписанию
*
* @param \Throwable $th
* @return void
*/
private function logExecErr(\Throwable $th): void
{
$context = [
//Скрипт откуда запустилась задача
'command' => static::class,
//Скрипт, в котором произошла ошибка
'file' => $th->getFile(),
'line' => $th->getLine(),
];
\Log::channel('schedule_err')->error($th->getMessage(), $context);
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\TestData;
class testDataCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'data_base:test-data-command';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Тестовая команда';
/**
* Execute the console command.
*/
public function handle()
{
$testDataModel = new TestData;
$test = TestData::where('test_char', 'hellos')->get();
var_dump($test);
}
}
+38
View File
@@ -0,0 +1,38 @@
<?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();
//activity()->log('Look mum, I logged something');
#Гаврилов
//ПРОВЕРИТЬ, РАБОТАЕТ?
// $schedule->command('sanctum:prune-expired --hours=24')
// ->daily();
//->dailyAt('21:03');
// activity()
// ->byAnonymous()
// ->inLog('Shedule')
// ->event('clear_old_Sanctum_tokens');
$schedule->command('taxi:send-today-orders-mail')->dailyAt('08:00');
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}