本文整理汇总了PHP中S::combine方法的典型用法代码示例。如果您正苦于以下问题:PHP S::combine方法的具体用法?PHP S::combine怎么用?PHP S::combine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::combine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_index
function get_index()
{
$info = Current::config('company');
if ($this->input) {
// set null in place of missing values to avoid "Undefined variable" in view.
$info = $this->input + S::combine(array_keys($info), null);
}
$phone = head((array) $info['landline']) ?: head((array) $info['cellular']);
return (array) $info + array('contactsURL' => null, 'phone' => $phone);
}
示例2: substr
$query->where('status', '!=', substr($ofStatus, 1));
} else {
$query->where_in('status', $ofStatus);
}
$can['ofStatus'] = $ofStatus;
});
Event::listen(VANE_NS . 'order.list.query', function (Query $query, Block_Order $block, array &$can) {
$sorted = $block->in('sort', '');
$sorted or $query->order_by('updated_at', 'desc')->order_by('created_at', 'desc');
$filter = (array) $block->in('filter', '');
$query->commonList(array('paginate' => false, 'filter' => $filter));
$can['sort'] = $sorted ?: true;
$can['desc'] = (string) $block->in('desc', '0') ?: '0';
$fields = array('id', 'sum', 'address', 'phone', 'notes');
$fields = userFields($fields, 'order');
$defaults = S::combine($fields, null);
$can['filter'] = array_intersect_key($block->in(), $defaults) + $defaults;
});
Event::listen(VANE_NS . 'order.list.query', function (Query $query, Block_Order $block, array &$can) {
if ($date = $block->in('date', '')) {
$query->where(function ($query) use($date) {
if (strpbrk($date[0], '<>')) {
$op = $date[0];
$date = substr($date, 1);
} else {
$op = '=';
}
is_numeric($date) or $date = strtotime($date);
$date = with(new \DateTime())->setTimestamp((int) $date);
$date = strtok($date->format($query->grammar->datetime), ' ');
$query->where(\DB::raw('DATE(created_at)'), $op, $date)->or_where(\DB::raw('DATE(updated_at)'), $op, $date);