private function purgeOldVersions()
    {
        $keep = isset($this->keepOldVersions) ? $this->keepOldVersions : 0;
        $count = $this->versions()->count();

        if ((int)$keep > 0 && $count > $keep) {
            $oldVersions = $this->versions()
                ->latest()
                ->take($count)
                ->skip($keep)
                ->get()
                ->each(function ($version) {
                $version->delete();
            });
        }
    }
private function purgeOldVersions()
    {
        $keep = isset($this->keepOldVersions) ? $this->keepOldVersions : 0;
        $count = $this->versions()->count();

        if ((int)$keep > 0 && $count > $keep) {
            $oldVersions = $this->versions()
                ->latest()
                ->take($count)
                ->skip($keep)
                ->get()
                ->each(function ($version) {
                $version->delete();
            });
        }
    }
private function purgeOldVersions ( ) { $ keep = isset ( $ this -> keepOldVersions ) ? $ this -> keepOldVersions : 0 ; $ count = $ this -> versions ( ) -> count ( ) ; if ( ( int ) $ keep > 0 && $ count > $ keep ) { $ oldVersions = $ this -> versions ( ) -> latest ( ) -> take ( $ count ) -> skip ( $ keep ) -> get ( ) -> each ( function ( $ version ) { $ version -> delete ( ) ; } ) ; } }
Delete old versions of this model when the reach a specific count.

@return void
Delete old versions of this model when the reach a specific count .