clrghouz/app/Traits/ScopeActive.php

18 lines
243 B
PHP
Raw Normal View History

<?php
/**
* Add a ScopeActive to an Eloquent Model
*/
namespace App\Traits;
trait ScopeActive
{
/**
* Only query active records
*/
2021-06-14 11:33:18 +00:00
public function scopeActive($query)
{
2021-06-14 11:33:18 +00:00
return $query->where($this->getTable().'.active',TRUE);
}
}