public function getMeta($key, $default = null, $getObj = false)
    {
        $meta = $this->meta()
            ->where('key', $key)
            ->get();

        if ($getObj) {
            $collection = $meta;

        } else {
            $collection = new Collection();

            foreach ($meta as $m) {
                $collection->put($m->id, $m->value);
            }
        }

        // Were there no records? Return NULL if no default provided
        if (0 == $collection->count()) {
            return $default;
        }

        return $collection->count() <= 1 ? $collection->first() : $collection;
    }
public function getMeta($key, $default = null, $getObj = false)
    {
        $meta = $this->meta()
            ->where('key', $key)
            ->get();

        if ($getObj) {
            $collection = $meta;

        } else {
            $collection = new Collection();

            foreach ($meta as $m) {
                $collection->put($m->id, $m->value);
            }
        }

        // Were there no records? Return NULL if no default provided
        if (0 == $collection->count()) {
            return $default;
        }

        return $collection->count() <= 1 ? $collection->first() : $collection;
    }
public function getMeta ( $ key , $ default = null , $ getObj = false ) { $ meta = $ this -> meta ( ) -> where ( 'key' , $ key ) -> get ( ) ; if ( $ getObj ) { $ collection = $ meta ; } else { $ collection = new Collection ( ) ; foreach ( $ meta as $ m ) { $ collection -> put ( $ m -> id , $ m -> value ) ; } } // Were there no records? Return NULL if no default provided if ( 0 == $ collection -> count ( ) ) { return $ default ; } return $ collection -> count ( ) <= 1 ? $ collection -> first ( ) : $ collection ; }
Gets meta data

@param $key
@param null $default
@param bool $getObj
@return Collection
Gets meta data