This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is Pseudocode | |
function adjustOrder(list): | |
// Step 1: Adjust invalid values | |
for each element in list: | |
if element.order <= 0: | |
element.order = null // Mark as "no order" | |
// Step 2: Sort the list by 'order', moving null to the end | |
sort list by: | |
if a.order is null then return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('getChanges')) { | |
function getChanges(Model $model, $original = null) | |
{ | |
$hiddenFields = ['FechaRegistro', 'FechaModificacion', 'rbupdate', 'updated_at', 'created_at', 'Id']; | |
$modifiedModel = $model->replicate(); | |
$originalModel = $original ? $original : $model->refresh(); | |
$changes = ' se ha cambiado '; | |
foreach ($originalModel->getAttributes() as $key => $originalValue) { | |
if (in_array($key, $hiddenFields)) continue; |