- 1
- 2
- 3
foreach ($properties->xml->ЗначенияСвойства as $property) {
//......
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 3
0
foreach ($properties->xml->ЗначенияСвойства as $property) {
//......
}
$properties->xml->ЗначенияСвойства
−1
public function index()
{
$items = CartManager::getAllItems();
$couponCode = Coupon::getFromSession()->implode('code', ', ');
$address = auth()->user()->address;
$user = auth()->user();
$userDetails = auth()->user() ? auth()->user()->fields : null;
$fields = [
'promo_code' => $couponCode,
'email' => $user->email,
'first_name' => $userDetails->firstname,
'last_name' => $userDetails->lastname,
'phone' => $userDetails->phone,
];
if ($address) {
$field = [
'value' => $address->city->title
];
if ($address->city->type === \App\Address::TYPE_CITY) {
$field ['data']['city_fias_id'] = $address->city->id;
$field ['data']['city'] = $address->city->title;
} elseif ($address->city->type === \App\Address::TYPE_SETTLEMENT) {
$field ['data']['settlement_fias_id'] = $address->city->id;
$field ['data']['settlement'] = $address->city->title;
}
$fields ['delivery_city'] = $field;
}
if ($address->street) {
$fields ['delivery_street'] = [
'value' => $address->street->title,
'data' => [
'street_fias_id' => $address->street->id,
]
];
}
if ($address->street_number) {
$fields ['delivery_house_number'] = [
'value' => $address->street_number,
];
}
if ($address->flat) {
$fields ['delivery_flat_number'] = $address->flat;
}
$fields = (object)$fields;
$actions = [
'remove' => route('shop.cart.remove'),
'remove_gift_card' => route('shop.cart.gift-cards.remove'),
'change' => route('shop.cart.update'),
'promo' => route('shop.coupon.apply'),
'checkout' => route('orders.store'),
'get_pickups' => route('delivery_points.index'),
'check_email' => route('check_email'),
];
return view('shop.cart.index', compact(
'items',
'address',
'couponCode',
'fields',
'actions'
));
}
this is MVC, baby !
−1
private function changePlans(Coupon $coupon): Coupon
{
$coupon->paypal_plan_yearly_rub_id = $this->getPaypalId($coupon->billingPlanYearlyRub, $coupon);
$coupon->paypal_plan_yearly_usd_id = $this->getPaypalId($coupon->billingPlanYearlyUsd, $coupon);
$coupon->paypal_plan_monthly_rub_id = $this->getPaypalId($coupon->billingPlanMonthlyRub, $coupon);
$coupon->paypal_plan_monthly_usd_id = $this->getPaypalId($coupon->billingPlanMonthlyUsd, $coupon);
return $coupon;
}
Вот это забавно $this->getPaypalId($coupon->billingPlanMonthlyUsd, $coupon); (getPaypalId приватный)