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