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


PHP DB::connection方法代码示例

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


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

示例1: getFeira

 public function getFeira($id)
 {
     $dados = \DB::connection('mysql')->select(\DB::raw("SELECT *, date_format(data, '%d-%m-%Y %H:%i') as dataBR FROM feira WHERE id={$id}"))[0];
     //        $function = new Functions();
     //        $dados->data = $function->convertDataToBR("2016-01-02");
     return $dados;
 }
开发者ID:silvacarvalho,项目名称:Treinamento,代码行数:7,代码来源:Feira.php

示例2: getQuery

 public function getQuery($r)
 {
     $q = $r->toSql();
     $rGet = $r->get();
     $arr = $r->getBindings();
     $pdo = \DB::connection()->getPdo();
     foreach ($arr as $val) {
         //echo $pdo->quote($val)."|<br>"; preg_match('~= \?~', '= ' . $pdo->quote($val), $arr);printR($arr);
         $q = preg_replace('~(<=|>=|=|<|!=) \\?~', '= ' . $pdo->quote($val), $q, 1);
     }
     return $q;
 }
开发者ID:nowarena,项目名称:homestead,代码行数:12,代码来源:ModelNA.php

示例3: insertDocument

 public static function insertDocument($request)
 {
     $result = Result::find($request->results_id);
     $result->res_status = 1;
     $result->save();
     $validacion = Validation::find($result->validations_id);
     $data = explode('|', $validacion->val_data);
     $documento = \Input::file('document');
     $nombre = $result->res_referen . '_' . $data[0];
     $dir = '../../public_html/clientes/ftp/' . Session::get('empresa') . '/pdf/';
     if (null === $documento) {
         $documento->move($dir, $nombre);
     }
     $nombredoc = \DB::connection('master')->table('mdb_tipodocum')->where('doc_clave', $data[0])->first();
     \DB::connection('users')->table('opauimg')->insert(['pk_referencia' => $result->res_referen, 'imgNameFile' => $nombre, 'strImageName' => $nombredoc->doc_nombre, 'imgtipo' => 'application/pdf', 'imgtipodoc' => $data[0]]);
 }
开发者ID:huerfAna,项目名称:auditoria-webapp,代码行数:16,代码来源:Solution.php

示例4: isValid

 public function isValid($data)
 {
     $tamanio = 0;
     $valor = 1;
     if ($data['entrada'] == 1) {
         $campo = 'pk_referencia';
     } else {
         $campo = 'folio_ds';
     }
     $consulta = \DB::connection('users')->table($data['tabla'])->where($campo, $data['referencia'])->get();
     if ($consulta != null) {
         foreach ($consulta as $query) {
             //============================== Validaciones ================================
             if ($data['attr_id'] == 4) {
                 if ($query->{$data}['campos'] == '') {
                     $valor = 0;
                 }
             }
             if ($data['attr_id'] == 2) {
                 $campo = explode(",", $data['campos']);
                 if ($data['attr_id'] == 2) {
                     for ($i = 0; $i < count($campo); $i++) {
                         $tamanio += strlen($query->{$campo}[$i]);
                     }
                     if ($tamanio != $data['data_val']) {
                         $valor = 0;
                     }
                 } else {
                     $campos = $campo[0];
                 }
             }
             if ($data['attr_id'] == 6 || $data['attr_id'] == 5) {
                 $catalogo = explode("|", $data['data_val']);
                 $tablaval = $catalogo[0];
                 $campoval = $catalogo[1];
                 Session::put('tablacat', $tablaval);
                 if ($data['attr_id'] == 5) {
                     $formula = explode(',', $catalogo[1]);
                     $campobd = $formula[0];
                     $operador = $formula[1];
                     $result = $formula[2];
                     $camposwh = Anexo22::find($result)->relationships->where('origin_id', $data['entrada'])->first();
                     $campowh = explode(',', $camposwh->field);
                     $val_campo = Catalog::where($catalogo[2], 'LIKE', '%' . $query->{$data}['campos'] . '%')->where($campobd, $query->{$campowh}[0])->count();
                 }
                 if ($data['attr_id'] == 6) {
                     $campo = explode(',', $data['campos']);
                     $campocat = $campo[0];
                     $val_campo = Catalog::where($campoval, $query->{$campocat})->count();
                 }
                 if ($val_campo == 0) {
                     $valor = 0;
                 }
             }
             if ($data['attr_id'] == 3) {
                 $camposval = explode(",", $data['data_val']);
                 $valanexo = Anexo22::find($camposval[0]);
                 $campanx = $valanexo->a22_field;
                 if ($query->{$campanx} != $camposval[1]) {
                     $valor = 0;
                 }
             }
             if ($data['attr_id'] == 8) {
                 //$camposval = explode(",", $data['campos']);
                 $valores = explode("|", $data['data_val']);
                 $identif = $valores[1];
                 $docum = $valores[0];
                 $documentos = \DB::connection('users')->table('opauimg')->where('pk_referencia', $data['referencia'])->where('imgtipodoc', $docum)->count();
                 if ($query->{$data}['campos'] != $identif && $documentos == 0) {
                     $valor = 0;
                 }
             }
         }
     }
     return $valor;
 }
开发者ID:huerfAna,项目名称:auditoria2,代码行数:76,代码来源:Validation.php


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