php - Laravel array helpers if array has a value -


i have array has below returned blade :

array (  [0] => array ( [addons] => array ( [name] => icann [type] => addons [value] => +20.00 [attributes] => array ( [description] => icann fee ) ) )  [1] => array ( [package] => array ( [name] => domain [type] => package [value] => +0.00 [attributes] => array ( [description] => domain registration ) ) ) ) 

how can check if value icann in addons['name'] exists ie addons['name']=icann , description ie addons['attributes']['description'] in blade template ?

from question author

i realized array_has() did not acctually required value after searching created contract/interface below method validator , used @inject in blade access interface class below :

method in interface

public  function search_array($needle, $haystack) {   if(in_array($needle, $haystack)) {       return true;  }  foreach($haystack $element) {       if(is_array($element) && $this->search_array($needle, $element))            return true;  }  return false; }  

blade template

  @inject('searchicann', 'app\helpers\contracts\rocketshipcontract')   @if ($searchicann->search_array('icann', $array ))      found   @endif 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -