18 lines
243 B
PHP
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);
|
|
}
|
|
}
|