-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] test it can set new order without global scope
- Loading branch information
1 parent
027cf37
commit 2117e30
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Spatie\EloquentSortable\Test; | ||
|
||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Spatie\EloquentSortable\Sortable; | ||
use Spatie\EloquentSortable\SortableTrait; | ||
|
||
class DummyWithGlobalScope extends Model implements Sortable | ||
{ | ||
use SortableTrait; | ||
|
||
protected $table = 'dummies'; | ||
protected $guarded = []; | ||
public $timestamps = false; | ||
|
||
/** | ||
* The "booting" method of the model. | ||
* | ||
* @return void | ||
*/ | ||
protected static function boot() | ||
{ | ||
parent::boot(); | ||
|
||
parent::addGlobalScope('ActiveScope', function(Builder $builder) { | ||
$builder->where('is_active', true); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters