diff --git a/src/Meta.php b/src/Meta.php index 7f45cd6..f2eb5cd 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -156,6 +156,33 @@ class Meta extends Model implements MetaContract $table->uuid('uuid'); $table->text('meta'); } - + + /** + * Allows the searching of models by a meta value. + * + * @param mixed $key + * @param mixed $value + * + * @return \Illuminate\Support\Collection + */ + public static function metaWhere($key, $value){ + $return = array(); + + $models = self::all(); + + foreach( $models as $model ){ + + if ( $model->read($key) === $value ){ + array_push($return, $model); + } + + } + + return collect($return); + } + + /** + * UNIMPLEMENTED + */ public static function route(){} } \ No newline at end of file