2021-05-03 22:12:26 +10:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a ScopeActive to an Eloquent Model
|
|
|
|
*/
|
|
|
|
namespace App\Traits;
|
|
|
|
|
|
|
|
trait ScopeActive
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Only query active records
|
|
|
|
*/
|
|
|
|
public function scopeActive()
|
|
|
|
{
|
2021-04-01 21:59:15 +11:00
|
|
|
return $this->where($this->getTable().'.active',TRUE);
|
2021-05-03 22:12:26 +10:00
|
|
|
}
|
|
|
|
}
|