PMCORE-3092

This commit is contained in:
Paula Quispe
2021-07-26 13:13:26 -04:00
parent a0b9605d92
commit 6d500d78e2
19 changed files with 377 additions and 130 deletions

View File

@@ -9,4 +9,46 @@ class AppThread extends Model
protected $table = 'APP_THREAD';
// We do not have create/update timestamps for this table
public $timestamps = false;
/**
* Scope a query to filter a specific case
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $appUid
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeAppUid($query, string $appUid)
{
return $query->where('APP_UID', $appUid);
}
/**
* Scope a query to filter a specific index
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $index
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeIndex($query, int $index)
{
return $query->where('DEL_INDEX', $index);
}
/**
* Get thread related to the specific case and index
*
* @param string $appUid
* @param int $index
*
* @return array
*/
public static function getThread(string $appUid, int $index)
{
$query = AppThread::query()->select(['APP_THREAD_INDEX']);
$query->appUid($appUid);
$query->index($index);
$results = $query->get()->toArray();
return $results;
}
}