src/BoomCMS/Database/Models/Chunk/Slideshow.php
public function setSlidesAttribute($slides)
    {
        foreach ($slides as &$slide) {
            if (!$slide instanceof Slideshow\Slide) {
                $slide['url'] = (isset($slide['page']) && $slide['page'] > 0) ?
                    $slide['page']
                    : isset($slide['url']) ? $slide['url'] : null;

                unset($slide['page']);

                if (isset($slide['asset']) && is_array($slide['asset'])) {
                    $slide['asset_id'] = $slide['asset']['id'];
                    unset($slide['asset']);
                }

                $slide = new Slideshow\Slide($slide);
            }
        }

        $this->created(function () use ($slides) {
            $this->slides()->saveMany($slides);
        });
    }
public function setSlidesAttribute($slides)
    {
        foreach ($slides as &$slide) {
            if (!$slide instanceof Slideshow\Slide) {
                $slide['url'] = (isset($slide['page']) && $slide['page'] > 0) ?
                    $slide['page']
                    : isset($slide['url']) ? $slide['url'] : null;

                unset($slide['page']);

                if (isset($slide['asset']) && is_array($slide['asset'])) {
                    $slide['asset_id'] = $slide['asset']['id'];
                    unset($slide['asset']);
                }

                $slide = new Slideshow\Slide($slide);
            }
        }

        $this->created(function () use ($slides) {
            $this->slides()->saveMany($slides);
        });
    }
public function setSlidesAttribute ( $ slides ) { foreach ( $ slides as & $ slide ) { if ( ! $ slide instanceof Slideshow \ Slide ) { $ slide [ 'url' ] = ( isset ( $ slide [ 'page' ] ) && $ slide [ 'page' ] > 0 ) ? $ slide [ 'page' ] : isset ( $ slide [ 'url' ] ) ? $ slide [ 'url' ] : null ; unset ( $ slide [ 'page' ] ) ; if ( isset ( $ slide [ 'asset' ] ) && is_array ( $ slide [ 'asset' ] ) ) { $ slide [ 'asset_id' ] = $ slide [ 'asset' ] [ 'id' ] ; unset ( $ slide [ 'asset' ] ) ; } $ slide = new Slideshow \ Slide ( $ slide ) ; } } $ this -> created ( function ( ) use ( $ slides ) { $ this -> slides ( ) -> saveMany ( $ slides ) ; } ) ; }
Persists slide data to the database.
Persists slide data to the database .