本文整理匯總了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;
}