protected function setRelation($request)
    {
        $this->changeRelationModel();
        $relation = [];
        if ($request->has('group-thumbnail')) {
            $this->relations['thumbnails']['datas'] = collect($request->get('group-thumbnail'))->reject(function($item)
            {
                return ! $item['thumbnail_slug'] || ! $item['thumbnail_width'] || ! $item['thumbnail_height'];
            })->map(function($item,$key)
            {
                $item['slug'] = $item['thumbnail_slug'];
                unsetReturn($item,'thumbnail_slug');
                $item['photo_width'] = $item['thumbnail_width'];
                unsetReturn($item,'thumbnail_width');
                $item['photo_height'] = $item['thumbnail_height'];
                unsetReturn($item,'thumbnail_height');
                return $item;
            });
            if ($this->relations['thumbnails']['datas']->count() > 0) $relation[] = $this->relations['thumbnails'];
        }
        if ($request->has('group-extra')) {
            $this->relations['extras']['datas'] = collect($request->get('group-extra'))->reject(function($item)
            {
                return ! $item['extra_name'] || ! $item['extra_type'];
            })->map(function($item,$key)
            {
                $item['name'] = $item['extra_name'];
                unsetReturn($item,'extra_name');
                $item['type'] = $item['extra_type'];
                unsetReturn($item,'extra_type');
                return $item;
            });
            if ($this->relations['extras']['datas']->count() > 0) $relation[] = $this->relations['extras'];
        }
        $this->setOperationRelation($relation);
    }
protected function setRelation($request)
    {
        $this->changeRelationModel();
        $relation = [];
        if ($request->has('group-thumbnail')) {
            $this->relations['thumbnails']['datas'] = collect($request->get('group-thumbnail'))->reject(function($item)
            {
                return ! $item['thumbnail_slug'] || ! $item['thumbnail_width'] || ! $item['thumbnail_height'];
            })->map(function($item,$key)
            {
                $item['slug'] = $item['thumbnail_slug'];
                unsetReturn($item,'thumbnail_slug');
                $item['photo_width'] = $item['thumbnail_width'];
                unsetReturn($item,'thumbnail_width');
                $item['photo_height'] = $item['thumbnail_height'];
                unsetReturn($item,'thumbnail_height');
                return $item;
            });
            if ($this->relations['thumbnails']['datas']->count() > 0) $relation[] = $this->relations['thumbnails'];
        }
        if ($request->has('group-extra')) {
            $this->relations['extras']['datas'] = collect($request->get('group-extra'))->reject(function($item)
            {
                return ! $item['extra_name'] || ! $item['extra_type'];
            })->map(function($item,$key)
            {
                $item['name'] = $item['extra_name'];
                unsetReturn($item,'extra_name');
                $item['type'] = $item['extra_type'];
                unsetReturn($item,'extra_type');
                return $item;
            });
            if ($this->relations['extras']['datas']->count() > 0) $relation[] = $this->relations['extras'];
        }
        $this->setOperationRelation($relation);
    }
protected function setRelation ( $ request ) { $ this -> changeRelationModel ( ) ; $ relation = [ ] ; if ( $ request -> has ( 'group-thumbnail' ) ) { $ this -> relations [ 'thumbnails' ] [ 'datas' ] = collect ( $ request -> get ( 'group-thumbnail' ) ) -> reject ( function ( $ item ) { return ! $ item [ 'thumbnail_slug' ] || ! $ item [ 'thumbnail_width' ] || ! $ item [ 'thumbnail_height' ] ; } ) -> map ( function ( $ item , $ key ) { $ item [ 'slug' ] = $ item [ 'thumbnail_slug' ] ; unsetReturn ( $ item , 'thumbnail_slug' ) ; $ item [ 'photo_width' ] = $ item [ 'thumbnail_width' ] ; unsetReturn ( $ item , 'thumbnail_width' ) ; $ item [ 'photo_height' ] = $ item [ 'thumbnail_height' ] ; unsetReturn ( $ item , 'thumbnail_height' ) ; return $ item ; } ) ; if ( $ this -> relations [ 'thumbnails' ] [ 'datas' ] -> count ( ) > 0 ) $ relation [ ] = $ this -> relations [ 'thumbnails' ] ; } if ( $ request -> has ( 'group-extra' ) ) { $ this -> relations [ 'extras' ] [ 'datas' ] = collect ( $ request -> get ( 'group-extra' ) ) -> reject ( function ( $ item ) { return ! $ item [ 'extra_name' ] || ! $ item [ 'extra_type' ] ; } ) -> map ( function ( $ item , $ key ) { $ item [ 'name' ] = $ item [ 'extra_name' ] ; unsetReturn ( $ item , 'extra_name' ) ; $ item [ 'type' ] = $ item [ 'extra_type' ] ; unsetReturn ( $ item , 'extra_type' ) ; return $ item ; } ) ; if ( $ this -> relations [ 'extras' ] [ 'datas' ] -> count ( ) > 0 ) $ relation [ ] = $ this -> relations [ 'extras' ] ; } $ this -> setOperationRelation ( $ relation ) ; }
set the relations

@param $request
@return void
set the relations