public function exportToArray()
    {
        $data = $this->toArray();

        if (count($this->exportable) === 0) {
            return $data;
        }

        $exportData = [];
        foreach ($data as $key => $value) {
            if (in_array($key, $this->exportable)) {
                $exportData[$key] = $data[$key];
            }
        }
        return $exportData;
    }
public function exportToArray()
    {
        $data = $this->toArray();

        if (count($this->exportable) === 0) {
            return $data;
        }

        $exportData = [];
        foreach ($data as $key => $value) {
            if (in_array($key, $this->exportable)) {
                $exportData[$key] = $data[$key];
            }
        }
        return $exportData;
    }
public function exportToArray ( ) { $ data = $ this -> toArray ( ) ; if ( count ( $ this -> exportable ) === 0 ) { return $ data ; } $ exportData = [ ] ; foreach ( $ data as $ key => $ value ) { if ( in_array ( $ key , $ this -> exportable ) ) { $ exportData [ $ key ] = $ data [ $ key ] ; } } return $ exportData ; }
Export to array, which will exclude unexportable keys

@return array
Export to array which will exclude unexportable keys