PMCORE-2559
This commit is contained in:
@@ -34,6 +34,7 @@ class AppNotes extends Model
|
||||
*/
|
||||
protected $fillable = [
|
||||
'APP_UID',
|
||||
'APP_NUMBER',
|
||||
'USR_UID',
|
||||
'NOTE_DATE',
|
||||
'NOTE_CONTENT',
|
||||
@@ -57,6 +58,18 @@ class AppNotes extends Model
|
||||
return $query->where('APP_UID', $appUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific case id
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $appNumber
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeAppNumber($query, int $appNumber)
|
||||
{
|
||||
return $query->where('APP_NUMBER', $appNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the documents related to the case
|
||||
*
|
||||
@@ -72,6 +85,7 @@ class AppNotes extends Model
|
||||
$query = AppNotes::query()->select([
|
||||
'NOTE_ID',
|
||||
'APP_UID',
|
||||
'APP_NUMBER',
|
||||
'NOTE_DATE',
|
||||
'NOTE_CONTENT',
|
||||
'NOTE_TYPE',
|
||||
@@ -106,7 +120,7 @@ class AppNotes extends Model
|
||||
*
|
||||
* @param string $appUid
|
||||
*
|
||||
* @return array
|
||||
* @return int
|
||||
*/
|
||||
public static function getTotal(string $appUid)
|
||||
{
|
||||
@@ -116,4 +130,19 @@ class AppNotes extends Model
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total notes by case
|
||||
*
|
||||
* @param int $appNumber
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function total(int $appNumber)
|
||||
{
|
||||
$query = AppNotes::query()->select(['NOTE_ID']);
|
||||
$query->appNumber($appNumber);
|
||||
|
||||
return $query->get()->count();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user