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


PHP Schema::getColumnListing方法代码示例

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


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

示例1: translate

 public function translate(Request $request)
 {
     $data = $request->only('word', 'src_language', 'trans_language');
     $validator = Validator::make($data, array('word' => 'required', 'src_language' => 'required', 'trans_language' => 'required'));
     if ($validator->passes()) {
         $columns = Schema::getColumnListing('translation');
         // users table
         if (!in_array($data['src_language'], $columns)) {
             return response()->json(array('error' => 1, 'labels' => 'Source language is not available'));
         } else {
             if (!in_array($data['trans_language'], $columns)) {
                 return response()->json(array('error' => 1, 'labels' => 'Translation language is available'));
             } else {
                 $tra = Translation::where($data['src_language'], $data['word'])->first();
                 if (!$tra) {
                     return response()->json(array('error' => 1, 'labels' => 'This word is not available in our source language'));
                 } else {
                     $data = array('word' => $data['word'], 'source' => $data['src_language'], 'target' => $data['trans_language'], 'result' => $tra->{$data}['trans_language']);
                     return response()->json(array('error' => 0, 'data' => $data, 'errors' => array()));
                 }
             }
         }
     } else {
         return response()->json(array('error' => 1, 'labels' => $validator->messages()));
     }
 }
开发者ID:sagefix,项目名称:translator,代码行数:26,代码来源:TranslationController.php

示例2: search

 public function search($input)
 {
     $query = BarcodeProcess::query();
     $query->select('barcode_processes.*');
     $query->leftJoin('shelves', 'barcode_processes.shelf_id', '=', 'shelves.id');
     $columns = Schema::getColumnListing('barcode_processes');
     $attributes = array();
     foreach ($columns as $attribute) {
         $attributes[$attribute] = null;
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         }
     }
     /**
      * Filter
      */
     $this->filter($input, $query);
     /**
      * Get count
      */
     $total = $query->count();
     /**
      * Pagination
      */
     $this->pagination($input, $query);
     /**
      * Order
      */
     $this->order($input, $query);
     return [$query->get(), $attributes, 'total' => $total];
 }
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:32,代码来源:BarcodeProcessRepository.php

示例3: getTables

 /**
  * get OnData spec.
  *
  * @param  array  $data
  * @return array
  */
 function getTables(array $data)
 {
     $onData = [];
     $foreignKeys = [];
     $result = [];
     $tmp = '';
     $i = 0;
     $j = 0;
     foreach ($data as $key => $value) {
         if ($key == 'tbl' . $i) {
             $tmp = $value;
             if (in_array($value, $foreignKeys)) {
                 throw new \Exception($value . " Relation Already selected");
             }
             array_push($foreignKeys, $value);
             $i++;
         } elseif ($key == 'on' . $j) {
             if (!in_array($value, Schema::getColumnListing($tmp))) {
                 throw new \Exception($value . " Does not exist in " . $tmp);
             }
             array_push($onData, $value);
             $j++;
         }
     }
     $result[] = $onData;
     $result[] = $foreignKeys;
     return $result;
 }
开发者ID:censam,项目名称:lara-scaffold,代码行数:34,代码来源:helpers.php

示例4: search

 public function search($input)
 {
     $query = User::query();
     $columns = Schema::getColumnListing('users');
     $attributes = array();
     foreach ($columns as $attribute) {
         $attributes[$attribute] = null;
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         }
     }
     /*
      ** Filter
      */
     $this->filter($input, $query);
     /*
      ** Get count
      */
     $total = $query->count();
     /*
      ** Pagination
      */
     $this->pagination($input, $query);
     /*
      ** Order
      */
     $this->order($input, $query);
     return [$query->get(), $attributes, 'total' => $total];
 }
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:30,代码来源:UserRepository.php

示例5: scopeExcludeFromFind

 /**
  * Exclude from find
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeExcludeFromFind(Builder $query)
 {
     if (isset($this->excludedFromFind) == TRUE && is_array($this->excludedFromFind) == TRUE) {
         return $query->select(array_diff(Schema::getColumnListing($this->table), $this->excludedFromFind));
     } else {
         return $query;
     }
 }
开发者ID:jdrda,项目名称:olapus,代码行数:13,代码来源:AdminModelTrait.php

示例6: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $cols = Schema::getColumnListing('comments');
     unset($cols[0]);
     unset($cols[2]);
     unset($cols[3]);
     return response()->json(array_values($cols));
 }
开发者ID:SamChien,项目名称:product_service,代码行数:13,代码来源:CommentsController.php

示例7: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $cols = Schema::getColumnListing('products');
     unset($cols[0]);
     unset($cols[8]);
     unset($cols[9]);
     return response()->json(array_values($cols));
 }
开发者ID:SamChien,项目名称:product_service,代码行数:13,代码来源:ProductsController.php

示例8: getColumns

 public function getColumns($table = null, $class = null)
 {
     $class = $class ?: get_class($this);
     $table = $table ?: $this->table;
     if (!isset(self::$loaded_columns[$class])) {
         self::$loaded_columns[$class] = Schema::getColumnListing($table);
     }
     return self::$loaded_columns[$class];
 }
开发者ID:kevupton,项目名称:ethereal,代码行数:9,代码来源:Ethereal.php

示例9: getAttributes

 /**
  * Get attributes from an existing table.
  *
  * @return array
  */
 public function getAttributes()
 {
     //get table attributes
     $this->result = Schema::getColumnListing($this->table);
     //delete the first element, (ignore the id section)
     unset($this->result[0]);
     //get result
     return $this->result;
 }
开发者ID:amranidev,项目名称:scaffold-interface,代码行数:14,代码来源:Attribute.php

示例10: search

 /**
  * Search the images.
  *
  * @param string $input
  *
  * @return Collection
  */
 public function search($input)
 {
     $query = Image::orderBy('created_at', 'desc');
     $query->where('id', 'LIKE', '%' . $input['term'] . '%');
     $columns = Schema::getColumnListing('images');
     foreach ($columns as $attribute) {
         $query->orWhere($attribute, 'LIKE', '%' . $input['term'] . '%');
     }
     return [$query, $input['term'], $query->paginate(Config::get('quarx.pagination', 25))->render()];
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:17,代码来源:ImageRepository.php

示例11: search

 public function search($term)
 {
     $query = $this->model->orderBy('created_at', 'desc');
     $query->where('id', 'LIKE', '%' . $input['term'] . '%');
     $columns = Schema::getColumnListing(str_plural($this->modelName));
     foreach ($columns as $attribute) {
         $query->orWhere($attribute, 'LIKE', '%' . $input['term'] . '%');
     }
     return ['term' => $input['term'], 'result' => $query->paginate(Config::get('quarx.pagination', 25))];
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:10,代码来源:ApiController.php

示例12: getAttributes

 /**
  * Deduce relational arttributes.
  *
  * @return void
  */
 private function getAttributes()
 {
     collect($this->foreignKeys)->each(function ($key, $value) {
         $Schema = collect(Schema::getColumnListing($key));
         $Schema = $Schema->reject(function ($value, $key) {
             return str_contains($value, 'id');
         });
         $this->relationAttributes[$key] = $Schema->toArray();
     });
 }
开发者ID:amranidev,项目名称:scaffold-interface,代码行数:15,代码来源:Datasystem.php

示例13: search

 public function search($input)
 {
     $query = Widget::orderBy('created_at', 'desc');
     $query->where('id', 'LIKE', '%' . $input['term'] . '%');
     $columns = Schema::getColumnListing('widgets');
     foreach ($columns as $attribute) {
         $query->orWhere($attribute, 'LIKE', '%' . $input['term'] . '%');
     }
     return [$query, $input['term'], $query->paginate(25)->render()];
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:10,代码来源:WidgetRepository.php

示例14: getClassProperties

 /**
  * @param string $className
  *
  * @return array
  */
 protected static function getClassProperties($className)
 {
     if (\class_exists($className, true)) {
         $reflection = new ReflectionClass($className);
         $value = $reflection->newInstanceWithoutConstructor();
         if (\is_subclass_of($value, Model::class, true)) {
             $attributes = Schema::getColumnListing($value->getTable());
             self::$eloquentClasses[$className] = $attributes;
         }
     }
     return !empty(self::$eloquentClasses[$className]) ? self::$eloquentClasses[$className] : parent::getClassProperties($className);
 }
开发者ID:marcogrueter,项目名称:laravel5-jsonapi-transformer,代码行数:17,代码来源:MappingFactory.php

示例15: getAttr

 /**
  * Analyse data and attributes
  *
  * @param Array $data
  */
 private function getAttr($data)
 {
     foreach ($this->foreignKeys as $key => $value) {
         $Schema = Schema::getColumnListing($value);
         unset($Schema[0]);
         foreach ($Schema as $SchemaKey => $SchemaValue) {
             if (strpos($SchemaValue, '_id')) {
                 unset($Schema[$SchemaKey]);
             }
         }
         $this->relationAttr[$value] = $Schema;
     }
 }
开发者ID:censam,项目名称:lara-scaffold,代码行数:18,代码来源:DataSystem.php


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