mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 15:33:44 +01:00
Updated Labels class
Removed unused function Added assigned() hasMany
This commit is contained in:
parent
c9108efd63
commit
bb07f86deb
@ -43,14 +43,9 @@ class Labels extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function labelsForService(string $service_id)
|
public function assigned()
|
||||||
{
|
{
|
||||||
return Cache::remember("labels_for_service.$service_id", now()->addMinute(5), function () use ($service_id) {
|
return $this->hasMany(LabelsAssigned::class, 'label_id', 'id');
|
||||||
return DB::table('labels_assigned as l')
|
|
||||||
->join('labels', 'l.label_id', '=', 'labels.id')
|
|
||||||
->where('l.service_id', '=', $service_id)
|
|
||||||
->get(['labels.id', 'labels.label']);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user