visuddhinanda 1 неделя назад
Родитель
Сommit
353523b70b
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      api-v13/app/Models/Sentence.php

+ 7 - 0
api-v13/app/Models/Sentence.php

@@ -48,6 +48,13 @@ class Sentence extends Model
         return $this->belongsTo(Channel::class, 'channel_uid', 'uid');
     }
 
+    public function scopeType($query, $type)
+    {
+        return $query->whereHas('channel', function ($q) use ($type) {
+            $q->where('type', $type);
+        });
+    }
+
     public function scopeNissaya($query)
     {
         return $query->whereHas('channel', function ($q) {