This commit is contained in:
Juan Pablo Vial
2023-07-24 20:41:38 -04:00
parent 6ab24c8961
commit be33305cf1
612 changed files with 11436 additions and 107 deletions

View File

@ -0,0 +1,39 @@
<?php
namespace App\Controller;
use App\Definition\Controller;
use App\Helper\Color;
use App\Helper\Line;
use Incoviba\common\Registry as RModel;
class Registros
{
use Controller;
public static function list()
{
$registros = model(RModel::class)->orderByDesc('time')->findMany();
$ini = new Color(0, 100, 0);
$end = new Color(255, 255, 255);
$colores = self::colores($end, $ini, 100);
return view('admin.registros.list', compact('registros', 'colores'));
}
public static function show()
{
$registro = model(RModel::class)->findOne(get('registro'));
$ini = new Color(0, 100, 0);
$end = new Color(255, 255, 255);
$colores = self::colores($end, $ini, 100);
return view('admin.registros.show', compact('registro', 'colores'));
}
protected static function colores($ini, $end, $max)
{
$current = $ini->toVector();
$colores = [];
$line = new Line($ini->toVector(), $end->toVector());
for ($i = 0; $i < $max; $i ++) {
$colores[$i] = new Color($current);
$current = $line->move($current, $line->length() / $max);
}
return $colores;
}
}