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; } }