Added 'Is Enabled' scope to Question model
This commit is contained in:
parent
d45d0a39e5
commit
8914cb63fd
|
|
@ -51,9 +51,20 @@ class Question extends MyBaseModel
|
|||
return $this->hasMany('\App\Models\QuestionOption');
|
||||
}
|
||||
|
||||
public function tickets() {
|
||||
public function tickets()
|
||||
{
|
||||
return $this->belongsToMany('\App\Models\Ticket');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include active questions.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeIsEnabled($query)
|
||||
{
|
||||
return $query->where('is_enabled', 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue