Skip to content

Instantly share code, notes, and snippets.

@overtrue
Last active October 17, 2017 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save overtrue/7f3cd0c559da43d6f17babf967ab5fbf to your computer and use it in GitHub Desktop.
Save overtrue/7f3cd0c559da43d6f17babf967ab5fbf to your computer and use it in GitHub Desktop.
Model methods
<?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