Skip to content

Commit 1b82138

Browse files
committed
✨ add latest() and oldest() methods
Signed-off-by: otengkwame <[email protected]>
1 parent 0f93da8 commit 1b82138

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Core/core/Models/EasyModel.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,28 @@ public function orderBy($orderby, $direction = '')
13941394
return $this;
13951395
}
13961396

1397+
/**
1398+
* latest function
1399+
*
1400+
* @param string $column
1401+
* @return mixed
1402+
*/
1403+
public function latest($column = 'created_at')
1404+
{
1405+
return $this->orderBy($column, 'desc');
1406+
}
1407+
1408+
/**
1409+
* oldest function
1410+
*
1411+
* @param string $column
1412+
* @return mixed
1413+
*/
1414+
public function oldest($column = 'created_at')
1415+
{
1416+
return $this->orderBy($column, 'asc');
1417+
}
1418+
13971419
/**
13981420
* Limit function
13991421
*

0 commit comments

Comments
 (0)