clrghouz/app/Traits/ScopeActive.php
2021-06-14 21:33:18 +10:00

18 lines
243 B
PHP

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