Type hint all device model relations (#12686)

This commit is contained in:
Jellyfrog
2021-03-31 17:28:47 +02:00
committed by GitHub
co-authored by GitHub
parent dc160c6813
commit 4b6efba040
28 changed files with 90 additions and 64 deletions
+3 -1
View File
@@ -24,6 +24,8 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
class AlertTemplate extends BaseModel
{
public $timestamps = false;
@@ -35,7 +37,7 @@ class AlertTemplate extends BaseModel
return $this->hasMany(\App\Models\AlertTemplateMap::class, 'alert_templates_id', 'id');
}
public function alert_rules()
public function alert_rules(): HasManyThrough
{
return $this->hasManyThrough(\App\Models\AlertRule::class, \App\Models\AlertTemplateMap::class, 'alert_templates_id', 'id', 'id', 'alert_rule_id')
->select(['id' => 'alert_rules.id', 'name' => 'alert_rules.name'])