protected function run($models)
    {
        $models = collect($models);
        if ($models->count() > 0) {
            $model = $models->first();

            if (!is_object($model)) {
                return;
            }

            if (!$this->isCascadable($model)) {
                return;
            }

            if (!in_array($model->getConnectionName(), $this->dbsToTransact)) {
                $this->dbsToTransact[] = $model->getConnectionName();
                DB::connection($model->getConnectionName())->beginTransaction();
            }

            $this->relations($model, $models->pluck($model->getKeyName()));
        }
    }
protected function run($models)
    {
        $models = collect($models);
        if ($models->count() > 0) {
            $model = $models->first();

            if (!is_object($model)) {
                return;
            }

            if (!$this->isCascadable($model)) {
                return;
            }

            if (!in_array($model->getConnectionName(), $this->dbsToTransact)) {
                $this->dbsToTransact[] = $model->getConnectionName();
                DB::connection($model->getConnectionName())->beginTransaction();
            }

            $this->relations($model, $models->pluck($model->getKeyName()));
        }
    }
protected function run ( $ models ) { $ models = collect ( $ models ) ; if ( $ models -> count ( ) > 0 ) { $ model = $ models -> first ( ) ; if ( ! is_object ( $ model ) ) { return ; } if ( ! $ this -> isCascadable ( $ model ) ) { return ; } if ( ! in_array ( $ model -> getConnectionName ( ) , $ this -> dbsToTransact ) ) { $ this -> dbsToTransact [ ] = $ model -> getConnectionName ( ) ; DB :: connection ( $ model -> getConnectionName ( ) ) -> beginTransaction ( ) ; } $ this -> relations ( $ model , $ models -> pluck ( $ model -> getKeyName ( ) ) ) ; } }
Run the cascade.

@param Illuminate\Database\Eloquent\Model $models

@return void
Run the cascade .