Last active
October 17, 2017 02:48
-
-
Save overtrue/7f3cd0c559da43d6f17babf967ab5fbf to your computer and use it in GitHub Desktop.
Model methods
This file contains hidden or 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
<?php | |
namespace App\Models; | |
class Model | |
{ | |
public static function withoutEvents(Closure $closure) | |
{ | |
$dispatcher = self::getEventDispatcher(); | |
self::unsetEventDispatcher(); | |
call_user_func($closure); | |
self::setEventDispatcher($dispatcher); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment