Added 'Is Enabled' scope to Question model

This commit is contained in:
Dave Earley 2016-05-28 09:16:44 +01:00
parent d45d0a39e5
commit 8914cb63fd
1 changed files with 12 additions and 1 deletions

View File

@ -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);
}
}