original_string: protected static function boot()
      {
          parent::boot();
  
          static::addGlobalScope(new MailingScope);
  
          static::creating(function ($node)
          {
              if (empty($node->published_at))
              {
                  $node->published_at = Carbon::now();
              }
  
              $node->fireNodeEvent('creating');
          });
  
          static::created(function ($node)
          {
              $node->propagateIdToSources(false);
  
              $node->fireNodeEvent('created');
          });
  
          static::saving(function ($node)
          {
              $node->validateCanHaveParentOfType();
  
              $node->fireNodeEvent('saving');
          });
  
          foreach (['updating', 'updated', 'deleting', 'deleted', 'saved'] as $event)
          {
              static::$event(function ($node) use ($event)
              {
                  $node->fireNodeEvent($event);
              });
          }
      }
code: protected static function boot()
      {
          parent::boot();
  
          static::addGlobalScope(new MailingScope);
  
          static::creating(function ($node)
          {
              if (empty($node->published_at))
              {
                  $node->published_at = Carbon::now();
              }
  
              $node->fireNodeEvent('creating');
          });
  
          static::created(function ($node)
          {
              $node->propagateIdToSources(false);
  
              $node->fireNodeEvent('created');
          });
  
          static::saving(function ($node)
          {
              $node->validateCanHaveParentOfType();
  
              $node->fireNodeEvent('saving');
          });
  
          foreach (['updating', 'updated', 'deleting', 'deleted', 'saved'] as $event)
          {
              static::$event(function ($node) use ($event)
              {
                  $node->fireNodeEvent($event);
              });
          }
      }
code_tokens: protected static function boot ( ) { parent :: boot ( ) ; static :: addGlobalScope ( new MailingScope ) ; static :: creating ( function ( $ node ) { if ( empty ( $ node -> published_at ) ) { $ node -> published_at = Carbon :: now ( ) ; } $ node -> fireNodeEvent ( 'creating' ) ; } ) ; static :: created ( function ( $ node ) { $ node -> propagateIdToSources ( false ) ; $ node -> fireNodeEvent ( 'created' ) ; } ) ; static :: saving ( function ( $ node ) { $ node -> validateCanHaveParentOfType ( ) ; $ node -> fireNodeEvent ( 'saving' ) ; } ) ; foreach ( [ 'updating' , 'updated' , 'deleting' , 'deleted' , 'saved' ] as $ event ) { static :: $ event ( function ( $ node ) use ( $ event ) { $ node -> fireNodeEvent ( $ event ) ; } ) ; } }
docstring: Boot model events
docstring_tokens: Boot model events