Beispiel #1
0
 public function onChangeCarrency()
 {
     $data = Input::all();
     $rules = ['user_name' => 'required', 'user_email' => 'required|email', 'user_coupon' => 'coupon'];
     $messages = ['required' => ' Поле :attribute обязательное для заполнения', 'email' => 'Почта должна соответствовать adress@site.domain', 'coupon' => 'Такого купона нет или уже использвется'];
     Validator::extend('coupon', function ($attribute, $value, $parameters) {
         $product_id = $this->propertyOrParam('idParam');
         /**
             $value, позможно, нужно защитить, хз))
         */
         return $this->loadCouponByValue($value);
     });
     $validation = Validator::make($data, $rules, $messages);
     if ($validation->fails()) {
         /**
             Валидация не пройдена
         */
         $this->page['errors'] = $validation->messages()->all();
     } else {
         /**
             Валидация пройдена
         */
         $this->page['user'] = $data;
         $this->page['product'] = $this->loadProduct();
         $this->page['coupon'] = $this->loadCouponByValue($data['user_coupon']);
         $this->page['settings'] = Settings::instance();
         $this->page['currencies'] = Currency::get()->keyBy('id')->toArray();
     }
 }
Beispiel #2
0
 public function beforeSave()
 {
     if ($this->is_default) {
         Currency::where('is_default', '=', 1)->update(array('is_default' => 0));
         $this->value = 1.0;
     }
 }
Beispiel #3
0
<?php

use Firestarter\Shop\Models\Product;
use Firestarter\Shop\Models\Coupon;
use Firestarter\Shop\Models\Order;
use Firestarter\Shop\Models\Currency;
use Firestarter\Shop\Models\Settings;
Route::group(['prefix' => 'license'], function () {
    Route::get('order/webmoney/wmz', function () {
        /**
          Нужны все валюты
        */
        $currencies = Currency::get()->keyBy('id')->toArray();
        /**
           Это предварительный запрос?
        */
        if (post('LMI_PREREQUEST') == 1) {
            /**
                Есть ли такой товар в базе?
            */
            if (!($product = Product::find(post('SHOP_USER_PRODUCT_ID'))->toArray())) {
            }
            die("ERROR: НЕТ ТАКОГО ТОВАРА");
            /**
                Строка с пользователем?
            */
            if (!post('SHOP_USER_NAME') or post('SHOP_USER_NAME') == '') {
                die("ERROR: НЕ УКАЗАН ПОЛЬЗОВАТЕЛЬ");
            }
            /**
                Строка с почтой?
Beispiel #4
0
 public function onRun()
 {
     $this->currencies = $this->page['currencies'] = Currency::get()->toArray();
     $this->products = $this->page['products'] = Product::get()->toArray();
 }
Beispiel #5
0
 public function getCurrenciesList()
 {
     return Currency::lists('name', 'id');
 }