本文整理汇总了PHP中Self::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Self::whereIn方法的具体用法?PHP Self::whereIn怎么用?PHP Self::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Self
的用法示例。
在下文中一共展示了Self::whereIn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatTagFilters
/**
* Returns formatted array containing the tags for filtering.
*
* @static true
* @access public
* @param array $arrTags
* @return array
* @since 1.0.0
*/
public static function formatTagFilters($arrTags)
{
//array to store the tag filters
$arrTagFilter = array();
$arrTagFilter['name'] = 'Tags';
$arrTagFilter['type'] = 'multi';
$dbResult = Self::whereIn('name', $arrTags)->select('id', 'name')->get();
if ($dbResult) {
foreach ($dbResult as $row) {
$arrTagFilter['options'][] = array('id' => $row->id, 'name' => $row->name);
}
}
return $arrTagFilter;
}
示例2: formatLocationFilters
/**
* Formats the details of the location for filtering
* whose name is in the passed array.
*
* @static true
* @access public
* @param array $arrLocation
* @return array
* @since 1.0.0
*/
public static function formatLocationFilters($arrLocation)
{
//array to store the locaiton details
$arrLocationFilter = array();
$arrLocationFilter['name'] = 'Locations';
$arrLocationFilter['type'] = 'Multi';
//query to read the location details
$queryResult = Self::whereIn('name', $arrLocation)->select('id', 'name')->get();
if ($queryResult) {
foreach ($queryResult as $row) {
$arrLocationFilter['options'][] = array("id" => $row->id, "name" => $row->name);
}
}
return $arrLocationFilter;
}