当前位置: 首页>>代码示例>>PHP>>正文


PHP Record::allow方法代码示例

本文整理汇总了PHP中Record::allow方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::allow方法的具体用法?PHP Record::allow怎么用?PHP Record::allow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Record的用法示例。


在下文中一共展示了Record::allow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_one

 public function create_one($params = [])
 {
     Session::permit_admin();
     $class = Filter::controller_model(get_called_class());
     $item = $class::create(Record::allow($params, ['name', 'title']));
     Render::json($class::read(['*'], $item['id']));
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:7,代码来源:ctrl.php

示例2: evaluate

 public function evaluate($params = [])
 {
     $params['scripting'] = Util::get_scripting()[intval(@$params['scriptingi'])];
     $model = Record::allow($params, ['name', 'email', 'phone', 'company', 'url', 'scripting']);
     $where = [implode(' = ? AND ', array_keys($model)) . ' = ?'] + $model;
     $evaluator = Evaluator::read(['*'], TRUE, $where);
     $today = gmdate('Y-m-d');
     $update = ['agreement_date' => $today, 'email_date' => $today, 'ip' => $_SERVER['REMOTE_ADDR'], 'opt_out' => 0];
     if (isset($evaluator['id'])) {
         Evaluator::update($update, $evaluator['id']);
         $evaluator += $update;
     } else {
         $model['`key`'] = Evaluator::get_unique_key($model);
         $model += $update;
         $evaluator = Evaluator::create($model);
         $evaluator['key'] = $evaluator['`key`'];
         unset($evaluator['`key`']);
     }
     $body = Template::render_doc_by_name('evaluate-email', $evaluator);
     $args = ['toname' => $evaluator['name'], 'toemail' => $evaluator['email'], 'fromname' => 'WinWrap Support', 'fromemail' => 'support@mail.winwrap.com', 'subject' => 'WinWrap Basic Evaluation', 'body' => $body];
     if (GoogleMail::send($args) === true) {
         unset($evaluator['id']);
         Render::json($evaluator);
     } else {
         header('Status: 500');
     }
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:27,代码来源:evaluate_ctrl.php

示例3: update

 public static function update($model, $id, $update_lit = '')
 {
     Session::permit_admin();
     $success = parent::update(Record::allow($model, ['title', 'name', 'type']), $id, $update_lit);
     if (isset($model['content'])) {
         $success = DocContent::create(['doc_id' => $id, 'content' => $model['content']]);
     }
     if (isset($model['routes'])) {
         DocRoute::destroy_all($id);
         if ($model['routes']) {
             $routes = [];
             foreach (explode(',', $model['routes']) as $route_def) {
                 $parts = explode('=>', $route_def);
                 $route = trim($parts[0]);
                 if (strlen($route) == 0 || $route[0] != '/') {
                     $route = '/' . $route;
                 }
                 $handler = count($parts) > 1 ? trim($parts[1]) : null;
                 $routes[] = ['doc_id' => $id, 'route' => $route, 'handler' => $handler ? $handler : null];
             }
             DocRoute::create_all($routes);
         }
     }
     return $success;
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:25,代码来源:doc.php

示例4: order_custom

 public function order_custom($params = [])
 {
     $parts = Part::get_parts();
     $order = Record::allow($params, array_keys($parts));
     $key = Quote::get_unique_key([]);
     $model['`key`'] = $key;
     $fields = ['company', 'address', 'country', 'billing_name', 'billing_email', 'billing_phone', 'technical_name', 'technical_email', 'discount', 'discount_desc'];
     $model += Record::allow($params, $fields);
     $quote = Quote::create($model);
     $total = 0;
     foreach ($order as $name => $value) {
         if ($value) {
             $model = ['quote_id' => $quote['id'], 'part' => $name, 'override' => null, 'quantity' => $value];
             QuoteItem::create($model);
         }
     }
     return Render::json(['key' => $key]);
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:18,代码来源:product_ctrl.php

示例5: create_one

 public static function create_one($model)
 {
     $model = Record::allow($model, ['email', 'password', 'auth']);
     $model['password'] = crypt($model['password'], SALT);
     return parent::create($model);
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:6,代码来源:user.php


注:本文中的Record::allow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。