public function saveAsync(array $options = [])
    {
        $create = !$this->exists;

        if ($this->fireModelEvent('saving') === false) {
            return false;
        }

        if ($create && $this->fireModelEvent('creating')  === false) {
            return false;
        }

        if (!$create && $this->fireModelEvent('updating') === false) {
            return false;
        }

        if ($this->usesTimestamps()) {
            $this->updateTimestamps();
        }

        $savePromise = $this->newQuery()->saveAsync();

        $savePromise->then(function ($result) use ($create, $options) {
            if (array_get($result, '@metadata.statusCode') === 200) {
                $this->exists = true;
                $this->wasRecentlyCreated = $create;
                $this->fireModelEvent($create ? 'created' : 'updated', false);

                $this->finishSave($options);
            }
        });

        return $savePromise;
    }
public function saveAsync(array $options = [])
    {
        $create = !$this->exists;

        if ($this->fireModelEvent('saving') === false) {
            return false;
        }

        if ($create && $this->fireModelEvent('creating')  === false) {
            return false;
        }

        if (!$create && $this->fireModelEvent('updating') === false) {
            return false;
        }

        if ($this->usesTimestamps()) {
            $this->updateTimestamps();
        }

        $savePromise = $this->newQuery()->saveAsync();

        $savePromise->then(function ($result) use ($create, $options) {
            if (array_get($result, '@metadata.statusCode') === 200) {
                $this->exists = true;
                $this->wasRecentlyCreated = $create;
                $this->fireModelEvent($create ? 'created' : 'updated', false);

                $this->finishSave($options);
            }
        });

        return $savePromise;
    }
public function saveAsync ( array $ options = [ ] ) { $ create = ! $ this -> exists ; if ( $ this -> fireModelEvent ( 'saving' ) === false ) { return false ; } if ( $ create && $ this -> fireModelEvent ( 'creating' ) === false ) { return false ; } if ( ! $ create && $ this -> fireModelEvent ( 'updating' ) === false ) { return false ; } if ( $ this -> usesTimestamps ( ) ) { $ this -> updateTimestamps ( ) ; } $ savePromise = $ this -> newQuery ( ) -> saveAsync ( ) ; $ savePromise -> then ( function ( $ result ) use ( $ create , $ options ) { if ( array_get ( $ result , '@metadata.statusCode' ) === 200 ) { $ this -> exists = true ; $ this -> wasRecentlyCreated = $ create ; $ this -> fireModelEvent ( $ create ? 'created' : 'updated' , false ) ; $ this -> finishSave ( $ options ) ; } } ) ; return $ savePromise ; }
Saves the model to DynamoDb asynchronously and returns a promise
@param array $options
@return bool|\GuzzleHttp\Promise\Promise
Saves the model to DynamoDb asynchronously and returns a promise