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
|
|
|
|
*/
|
2021-06-14 11:33:18 +00:00
|
|
|
public function scopeActive($query)
|
2021-05-03 12:12:26 +00:00
|
|
|
{
|
2021-06-14 11:33:18 +00:00
|
|
|
return $query->where($this->getTable().'.active',TRUE);
|
2021-05-03 12:12:26 +00:00
|
|
|
}
|
|
|
|
}
|