-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] add withoutGlobalScopes to setNewOrder method (#167)
* [FEAT] add withoutGlobalScopes to setNewOrder method * [FEAT] add withoutGlobalScopes to setNewOrder method * [FEAT] test it can set new order without global scope * Update README.md * Update README.md * [MOD] add modifyQuery with a callback instead of withoutGlobalScope for setting a new order * Update README.md * Update README.md * [FIX] fix missing modification of sqlite to mysql driver --------- Co-authored-by: Freek Van der Herten <freek@spatie.be>
- Loading branch information
1 parent
a7b01a7
commit e55bece
Showing
5 changed files
with
72 additions
and
1 deletion.
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
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
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