• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Schema\Builder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Database\Schema\Builder的典型用法代码示例。如果您正苦于以下问题:PHP Builder类的具体用法?PHP Builder怎么用?PHP Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: scopeVisible

 /**
  * @param Builder|\Illuminate\Database\Eloquent\Builder|Model $query
  * @return mixed
  */
 public function scopeVisible($query)
 {
     return $query->whereHas('profile', function ($query) {
         /** @var Profile $query */
         return $query->visible();
     });
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:11,代码来源:Post.php


示例2: createDivision

 /**
  *
  */
 public function createDivision(Builder $schema, $table)
 {
     $schema->create($table, function (Blueprint $table) {
         $table->engine = "InnoDB";
         $table->string('id', 255);
         $table = $this->setColumns($table);
         $table->primary(array('id'));
     });
 }
开发者ID:xpressengine,项目名称:xpressengine,代码行数:12,代码来源:DocumentMigration.php


示例3: __construct

 public function __construct()
 {
     // get custom schema object
     $this->schema = \DB::connection()->getSchemaBuilder();
     // bind new blueprint class
     $this->schema->blueprintResolver(function ($table, $callback) {
         return new Blueprint($table, $callback);
     });
 }
开发者ID:UTNianos,项目名称:2.0,代码行数:9,代码来源:Migration.php


示例4: upTable

 public function upTable(Builder $builder)
 {
     $builder->create($this->table, function (Blueprint $blueprint) {
         $blueprint->increments("id");
         $blueprint->string("key")->unique();
         $blueprint->string("tag");
         $blueprint->text("value");
         $blueprint->timestamp("created_at");
     });
 }
开发者ID:chatbox-inc,项目名称:token,代码行数:10,代码来源:TaggableEloquent.php


示例5: getMissingUpdateAttributes

 /**
  * POST and PUT requests must contain all attributes.
  * This method returns all fillable attributes which are missing.
  *
  * @param Model $model
  * @return array
  */
 protected function getMissingUpdateAttributes(Model $model)
 {
     $keys = array_keys($this->body->getArray());
     $columnNames = $this->schemaBuilder->getColumnListing($model->getTable());
     $attributes = [];
     foreach ($columnNames as $column) {
         if ($model->isFillable($column) && !in_array($column, $keys)) {
             $attributes[] = $column;
         }
     }
     return $attributes;
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:19,代码来源:HalApiResourceController.php


示例6: down

 /**
  * Undo the migration
  */
 public function down()
 {
     //Remove Field
     $this->schema->table('user_details', function ($table) {
         $table->dropColumn('profile_picture');
     });
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:10,代码来源:20160128181212_AddProfilePictureFieldToUserDetailsTable.php


示例7: down

 /**
  * Undo the migration
  */
 public function down()
 {
     $this->schema->table('user_works', function ($table) {
         $table->dropForeign('user_works_user_id_foreign');
     });
     //Drop table
     $this->schema->dropIfExists('user_works');
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:11,代码来源:20160110145813_CreateUserWorkTable.php


示例8: handle

 /**
  * Handle the event.
  *
  * @param AssignmentWasDeleted $event
  */
 public function handle(AssignmentWasDeleted $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof FilesFieldType) {
         return;
     }
     $this->schema->dropIfExists($table = $assignment->getStreamPrefix() . $assignment->getStreamSlug() . '_' . $fieldType->getField());
 }
开发者ID:samharrison7,项目名称:files-field_type,代码行数:14,代码来源:DropPivotTable.php


示例9: handle

 /**
  * Handle the event.
  *
  * @param AssignmentWasDeleted $event
  */
 public function handle(AssignmentWasDeleted $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof MultipleFieldType) {
         return;
     }
     $this->schema->dropIfExists($fieldType->getPivotTableName());
 }
开发者ID:bloveless,项目名称:multiple-field_type,代码行数:14,代码来源:DropPivotTable.php


示例10: handle

 /**
  * Install the extensions table.
  */
 public function handle()
 {
     $this->schema->dropIfExists('addons_extensions');
     $this->schema->create('addons_extensions', function (Blueprint $table) {
         $table->increments('id');
         $table->string('slug');
         $table->boolean('installed')->default(0);
         $table->boolean('enabled')->default(0);
     });
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:13,代码来源:InstallExtensionsTableHandler.php


示例11: down

 /**
  * Undo the migration
  */
 public function down()
 {
     //Drop foreign keys
     $this->schema->table('friend_requests', function ($table) {
         $table->dropForeign('friend_requests_sender_foreign');
         $table->dropForeign('friend_requests_receiver_foreign');
     });
     //Drop table
     $this->schema->dropIfExists('friend_requests');
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:13,代码来源:20160222184600_CreateFriendRequestTable.php


示例12: down

 /**
  * Undo the migration
  */
 public function down()
 {
     //Drop foreign keys
     $this->schema->table('lecturers_courses_faculties', function ($table) {
         $table->dropForeign('lecturer_courses_faculties_uom_id_foreign');
         $table->dropForeign('lecturer_courses_faculties_faculty_id_foreign');
         $table->dropForeign('lecturer_courses_faculties_course_id_foreign');
     });
     //Drop table
     $this->schema->dropIfExists('lecturers_courses_faculties');
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:14,代码来源:20160302175103_CreateLecturerFacultyCoursesTable.php


示例13: getColumnsOnCache

 /**
  * To get all columns on caching
  * 
  * @param \Illuminate\Database\Eloquent\Model $model
  * @return array
  */
 protected function getColumnsOnCache(Model $model)
 {
     /**
      * In normal scenario tables and  columns often is not changed. 
      * Therefore every time it is not need to access the database for knowing 
      * columns name. We don't want make preoccupy/busy to the database. 
      */
     $fullKey = $this->getFullName($model);
     return $this->cache->remember($fullKey, $this->getRememberTime(), function () use($model) {
         return $this->builder->getColumnListing($model->getTable());
     });
 }
开发者ID:muratsplat,项目名称:multilang,代码行数:18,代码来源:CheckerAttribute.php


示例14: handle

 /**
  * Handle the event.
  *
  * @param AssignmentWasCreated $event
  */
 public function handle(AssignmentWasCreated $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof FilesFieldType) {
         return;
     }
     $table = $assignment->getStreamPrefix() . $assignment->getStreamSlug() . '_' . $fieldType->getField();
     $this->schema->dropIfExists($table);
     $this->schema->create($table, function (Blueprint $table) {
         $table->integer('entry_id');
         $table->integer('file_id');
         $table->integer('sort_order')->nullable();
         $table->primary(['entry_id', 'file_id']);
     });
 }
开发者ID:samharrison7,项目名称:files-field_type,代码行数:21,代码来源:CreatePivotTable.php


示例15: createTokenScopesTable

 /**
  * Create the token scopes table.
  * 
  * @return void
  */
 protected function createTokenScopesTable()
 {
     $this->schema->create($this->tables['token_scopes'], function ($table) {
         $table->increments('id');
         $table->string('token', 40)->index();
         $table->string('scope')->index();
     });
 }
开发者ID:ash-rain,项目名称:oauth2-server-laravel,代码行数:13,代码来源:TableBuilder.php


示例16: handle

 /**
  * Handle the event.
  *
  * @param AssignmentWasCreated $event
  */
 public function handle(AssignmentWasCreated $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof MultipleFieldType) {
         return;
     }
     $table = array_get($fieldType->getConfig(), 'pivot_table', $assignment->getStreamPrefix() . $assignment->getStreamSlug() . '_' . $fieldType->getField());
     $foreignKey = $fieldType->getForeignKey();
     $otherKey = $fieldType->getOtherKey();
     $this->schema->dropIfExists($table);
     $this->schema->create($table, function (Blueprint $table) use($foreignKey, $otherKey) {
         $table->increments('id');
         $table->integer($foreignKey);
         $table->integer($otherKey);
     });
 }
开发者ID:bloveless,项目名称:multiple-field_type,代码行数:22,代码来源:CreatePivotTable.php


示例17: dropColumn

 /**
  * Drop a column.
  *
  * @param           $table
  * @param FieldType $type
  */
 public function dropColumn($table, FieldType $type)
 {
     $schema = $type->getSchema();
     if (!$this->schema->hasTable($table)) {
         return;
     }
     $this->schema->table($table, function (Blueprint $table) use($schema) {
         $schema->dropColumn($table);
     });
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:16,代码来源:AssignmentSchema.php


示例18: cleanup

 /**
  * Clean up abandoned streams.
  */
 public function cleanup()
 {
     /* @var StreamInterface $stream */
     foreach ($this->model->all() as $stream) {
         if (!$this->schema->hasTable($stream->getEntryTableName())) {
             $this->delete($stream);
         }
     }
     $translations = $this->model->getTranslationModel();
     $translations->leftJoin('streams_streams', 'streams_streams_translations.stream_id', '=', 'streams_streams.id')->whereNull('streams_streams.id')->delete();
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:StreamRepository.php


示例19: table

 /**
  * Create table if not exist.
  * @param string table
  * @param \Closure $callback
  */
 public function table($table, \Closure $callback)
 {
     try {
         parent::create($table, $callback);
     } catch (\Exception $e) {
         try {
             parent::table($table, $callback);
         } catch (\Exception $e) {
             echo $e->getMessage();
         }
     }
 }
开发者ID:offworks,项目名称:laraquent,代码行数:17,代码来源:Schema.php


示例20: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if ($connection = Capsule::connection($this->getConnection())) {
         $connection->useDefaultSchemaGrammar();
     } else {
         $app = app();
         $connection = $app['db']->connection($this->getConnection());
     }
     $schema = new Schema($connection);
     if (!$schema->hasTable('salesforce_tokens')) {
         $schema->create('salesforce_tokens', function (Blueprint $table) {
             $table->bigIncrements('id');
             $table->string('access_token');
             $table->string('refresh_token');
             $table->string('instance_base_url');
             $table->bigInteger('user_id');
             $table->datetime('expires')->nullable();
             $table->timestamps();
             $table->softDeletes();
         });
     }
 }
开发者ID:frankkessler,项目名称:salesforce-laravel-oauth2-rest,代码行数:27,代码来源:salesforce.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Schema\MySqlBuilder类代码示例发布时间:2022-05-23
下一篇:
PHP Schema\Blueprint类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap