Fetch value of a field base on id. We can pass one or multiple id to get name. Multiple id must be comma separated String.
App::InformationSet(NAME)->idToName(ID,FIELD,LINK, OPTIONS);
ID:
Pass id to get value. We can pass more then one id separated by comma. For example: 45,46,47
Field:
Field name to get in response
LINK:
Enable/Disable auto link.
OPTIONS
In option we can pass a particular hyper link to set in HTML tag. For example:
$options['link-url'] = "/http://'www.example.com/view-post/[id]"
[id] will always replace by row value of InformationSet.
See bellow example:
// Example 1
$str = App::InformationSet('countries')->idToName("13,14,220",'code','Yes');
pre($str);
<a href="http://www.example.com/information/manage/countries/view/13" >UY</a>,
<a href="http://www.example.com/information/manage/countries/view/14" >US</a>,
<a href="http://www.example.com//information/manage/countries/view/220" >BD</a>
//Example 2
$options['link-url'] = 'http://www.abc.com/view-post/[id]';
$str = App::InformationSet('countries')->idToName("13,14,220",'code','Yes',$options);
pre($str);
<a href="http://www.abc.com/view-post/13" >UY</a>,
<a href="http://www.abc.com/view-post/14" >US</a>,
<a href="http://www.abc.com/view-post/220" >BD</a>