public static function bootSluggable()
    {
        static::created(function($model) {
            if ($model->shouldRunEvent($model, 'created')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
                $model->save();
            }
        });

        static::updating(function($model) {
            if ($model->shouldRunEvent($model, 'updating')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

        static::saving(function($model) {
            if ($model->shouldRunEvent($model, 'saving')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

    }
public static function bootSluggable()
    {
        static::created(function($model) {
            if ($model->shouldRunEvent($model, 'created')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
                $model->save();
            }
        });

        static::updating(function($model) {
            if ($model->shouldRunEvent($model, 'updating')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

        static::saving(function($model) {
            if ($model->shouldRunEvent($model, 'saving')) {
                $model->{$model->getSlugColumn()} = $model->buildSlug();
            }
        });

    }
public static function bootSluggable ( ) { static :: created ( function ( $ model ) { if ( $ model -> shouldRunEvent ( $ model , 'created' ) ) { $ model -> { $ model -> getSlugColumn ( ) } = $ model -> buildSlug ( ) ; $ model -> save ( ) ; } } ) ; static :: updating ( function ( $ model ) { if ( $ model -> shouldRunEvent ( $ model , 'updating' ) ) { $ model -> { $ model -> getSlugColumn ( ) } = $ model -> buildSlug ( ) ; } } ) ; static :: saving ( function ( $ model ) { if ( $ model -> shouldRunEvent ( $ model , 'saving' ) ) { $ model -> { $ model -> getSlugColumn ( ) } = $ model -> buildSlug ( ) ; } } ) ; }
Register the model events for adding the slug.
Register the model events for adding the slug .