Added ScopeActive Trait. Change user model to be under Models
This commit is contained in:
parent
47075871dc
commit
de2b894b55
@ -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
|
||||||
{
|
{
|
||||||
|
17
src/Traits/ScopeActive.php
Normal file
17
src/Traits/ScopeActive.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user