This commit is contained in:
Andrea Adamczyk
2019-07-25 14:50:06 -04:00
parent 5b6c2927e4
commit dccb63c84b
4 changed files with 271 additions and 168 deletions

View File

@@ -39,4 +39,28 @@ class Process extends Model
{
return $this->hasOne(ProcessCategory::class, 'PRO_CATEGORY', 'CATEGORY_UID');
}
/**
* Obtains the process list for an specific user and/or for the specific category
*
* @param string $categoryUid
* @param string $userUid
* @return array
*
* @see ProcessMaker\BusinessModel\Light::getProcessList()
*/
public function getProcessList($categoryUid, $userUid)
{
$selectedColumns = ['PRO_UID', 'PRO_TITLE'];
$query = Process::query()
->select($selectedColumns)
->where('PRO_STATUS', 'ACTIVE')
->where('PRO_CREATE_USER', $userUid);
if (!empty($categoryUid)) {
$query->where('PRO_CATEGORY', $categoryUid);
}
return ($query->get()->values()->toArray());
}
}