Added ScopeActive Trait. Change user model to be under Models

This commit is contained in:
Deon George 2021-04-21 16:53:51 +10:00
parent 47075871dc
commit de2b894b55
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 18 additions and 1 deletions

View File

@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use Redirect; use Redirect;
use Session; use Session;
use App\User; use App\Models\User;
class AdminController extends Controller class AdminController extends Controller
{ {

View File

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