Filter an dataset with a keyword
<p>i have an list of fonts returned from the googlefontsapi</p>

<pre><code>public function filterFont() {

    $key = $this-&gt;request('key');
    $url = "https://www.googleapis.com/webfonts/v1/webfonts?key=''";
    $result = json_decode(file_get_contents( $url ));
    $filterfont = array_filter($result, function($obj)
    {
        $data = $obj-&gt;font_name == $key;
        $view = view('ajax.fonts', true)-&gt;with('data', $data);
        $value=array(

                'view'=&gt;$view
        );
        echo json_encode($value);

    });

}
</code></pre>

<p>now i want to filter the data according to a value how can i achieve this</p>