PMCORE-3369

This commit is contained in:
Paula Quispe
2021-09-24 13:55:09 -04:00
parent a1ddfe3b4d
commit 27c3bc4f6c
2 changed files with 11 additions and 6 deletions

View File

@@ -410,10 +410,11 @@ class Process extends Model
* @param string $category
* @param int $offset
* @param int $limit
* @param bool $paged
*
* @return array
*/
public static function getProcessesForHome($text = null, $category = null, $offset = null, $limit = null)
public static function getProcessesForHome($text = null, $category = null, $offset = null, $limit = null, $paged = true)
{
// Get base query
$query = Process::query()->select(['PRO_ID', 'PRO_TITLE']);
@@ -431,12 +432,15 @@ class Process extends Model
// Set "PRO_STATUS" condition
$query->status('ACTIVE');
// Set pagination if offset and limit are sent
if (!is_null($offset) && !is_null($limit)) {
$query->offset($offset);
$query->limit($limit);
if ($paged) {
// Set pagination if offset and limit are sent
if (!is_null($offset) && !is_null($limit)) {
$query->offset($offset);
$query->limit($limit);
}
}
// Order by "PRO_TITLE"
$query->orderBy('PRO_TITLE');