本文整理汇总了PHP中Thin\Arrays::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::get方法的具体用法?PHP Arrays::get怎么用?PHP Arrays::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thin\Arrays
的用法示例。
在下文中一共展示了Arrays::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: only
/**
* Get a subset of the items from the input data.
*
* @param array $keys
* @return array
*/
public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = [];
$inputs = $this->all();
foreach ($keys as $key) {
Arrays::set($results, $key, Arrays::get($inputs, $key));
}
return $results;
}
示例2: getOptionsMacroData
public function getOptionsMacroData($segment_id)
{
$user = session('user')->getUser();
$segment = Model::Segment()->find((int) $segment_id);
if ($segment) {
if (Inflector::lower($segment->name) == 'restaurant') {
return $this->getOptionsMacroDataResto($segment, $user);
}
}
if ($user) {
if (Arrays::is($user)) {
if (!is_integer($segment_id)) {
return [];
}
if (!isset($user['employee'])) {
return false;
}
if (!isset($user['settings'])) {
return false;
}
if (!isset($user['settings']['employee_index'])) {
return false;
}
if (!isset($user['employee'][$user['settings']['employee_index']])) {
return false;
}
// if (!isset($user['employee'][$user['settings']['employee_index']]['id'])) {
// return false;
// }
if (!isset($user['employee'][$user['settings']['employee_index']]['reseller_id'])) {
return false;
}
// $reselleremployee_id = $user['employee'][$user['settings']['employee_index']]['id'];
$reseller_id = $user['employee'][$user['settings']['employee_index']]['reseller_id'];
$reseller = Model::Reseller()->find((int) $reseller_id);
// $reselleremployee = Model::Reselleremployee()->find((int) $reselleremployee_id);
if ($reseller) {
// if ($reseller && $reselleremployee) {
if (is_integer($segment_id)) {
if ($segment) {
$form = $this->getOptionsFromMarket((int) $segment_id);
$returnForm = [];
if (!empty($form)) {
if (isset($form['offres_devis'])) {
$offres_devis = lib('option')->get('offres.devis.' . $segment_id, $reseller, 1);
if (is_bool($offres_devis)) {
$offres_devis = true === $offres_devis ? 1 : 0;
} elseif (empty($offres_devis)) {
$offres_devis = 0;
}
$returnForm['offres_devis'] = $offres_devis;
}
if (isset($form['agenda_partage'])) {
$agenda_partage = lib('option')->get('agenda.partage.' . $segment_id, $reseller, 1);
if (is_bool($agenda_partage)) {
$agenda_partage = true === $agenda_partage ? 1 : 0;
} elseif (empty($agenda_partage)) {
$agenda_partage = 0;
}
$returnForm['agenda_partage'] = $agenda_partage;
}
if (isset($form['delai_intervention'])) {
$delai_intervention = lib('option')->get('delai.intervention.' . $segment_id, $reseller, 0);
$returnForm['delai_intervention'] = $delai_intervention;
}
if (isset($form['montant_intervention'])) {
$montant_intervention = lib('option')->get('montant.intervention.' . $segment_id, $reseller, 0);
$returnForm['montant_intervention'] = $montant_intervention;
}
if (isset($form['zone_intervention'])) {
$zone_intervention = lib('option')->get('zone.intervention.' . $segment_id, $reseller, 0);
$returnForm['zone_intervention'] = $zone_intervention;
}
if (isset($form['langue'])) {
if (isset($form['langue']['values'])) {
$langues = Arrays::get($form, 'langue.values', []);
foreach ($langues as $ind => $key) {
$val = lib('option')->get('langue.' . $segment_id . '.' . $key, $reseller, false);
if (is_bool($val)) {
$val = true === $val ? 1 : 0;
} elseif (empty($val)) {
$val = 0;
}
$returnForm['langue_' . $ind] = $val;
}
}
}
if (isset($form['agenda_horaires'])) {
$days = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'];
foreach ($days as $day) {
$index_am_start = str_replace('##day##', $day, 'agenda_horaires_##day##_am_start');
$index_am_end = str_replace('##day##', $day, 'agenda_horaires_##day##_am_end');
$index_pm_start = str_replace('##day##', $day, 'agenda_horaires_##day##_pm_start');
$index_pm_end = str_replace('##day##', $day, 'agenda_horaires_##day##_pm_end');
$schedule = Model::Schedule()->where(['day', '=', (string) $day])->where(['reseller_id', '=', (int) $reseller->id])->first(true);
if ($schedule) {
$am_start = $schedule->am_start;
$am_end = $schedule->am_end;
$pm_start = $schedule->pm_start;
$pm_end = $schedule->pm_end;
//.........这里部分代码省略.........