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

PHP Facades\Schema类代码示例

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

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



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

示例1: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('artists', function (Blueprint $table) {
         $table->dropColumn('bandcamp');
         $table->dropColumn('patreon');
     });
 }
开发者ID:ppy,项目名称:osu-web,代码行数:12,代码来源:2016_12_01_114033_add_additional_links_to_artists.php


示例2: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::drop('novels');
     Schema::drop('chapters');
     Schema::drop('configs');
     Schema::drop('mails');
 }
开发者ID:roslairy,项目名称:nofetch,代码行数:12,代码来源:2015_08_26_120426_NoFetchMigration.php


示例3: getPermissions

 /**
  * Fetch the collection of site permissions.
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 protected function getPermissions()
 {
     if (!Schema::hasTable('roles')) {
         return new Collection();
     }
     return Permission::with('roles')->get();
 }
开发者ID:papertank,项目名称:origami-auth,代码行数:12,代码来源:AuthServiceProvider.php


示例4: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('oauth_auth_codes', function (Blueprint $t) {
         $t->dropForeign('oauth_auth_codes_session_id_foreign');
     });
     Schema::drop('oauth_auth_codes');
 }
开发者ID:nicklaw5,项目名称:ticketing-system-api,代码行数:12,代码来源:2015_10_19_000010_create_oauth_auth_codes_table.php


示例5: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('oauth_refresh_tokens', function (Blueprint $table) {
         $table->dropForeign('oauth_refresh_tokens_access_token_id_foreign');
     });
     Schema::drop('oauth_refresh_tokens');
 }
开发者ID:gabrielcabral,项目名称:laravel-codedelivery,代码行数:12,代码来源:2014_04_24_111810_create_oauth_refresh_tokens_table.php


示例6: down

 /**
  * Reverse the migrations.
  */
 public function down()
 {
     Schema::drop('account_modules', function (Blueprint $table) {
         $table->dropForeign('account_module_to_account');
         $table->dropForeign('account_module_to_module');
     });
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:10,代码来源:2015_08_25_085045_create_account_modules_table.php


示例7: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->confirm("Clear database? [Yes|no]", "Yes")) {
         $this->info('Clear database start');
         if (config('database.default') == 'mysql') {
             DB::statement('SET FOREIGN_KEY_CHECKS=0');
         } else {
             if (config('database.default') == 'sqlite') {
                 DB::statement('PRAGMA foreign_keys = OFF');
             }
         }
         $tableNames = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
         foreach ($tableNames as $v) {
             Schema::drop($v);
             $this->info('Dropped: ' . $v);
         }
         $this->info('Clear database end');
         if (config('database.default') == 'mysql') {
             DB::statement('SET FOREIGN_KEY_CHECKS=1');
         } else {
             if (config('database.default') == 'sqlite') {
                 DB::statement('PRAGMA foreign_keys = ON');
             }
         }
     }
 }
开发者ID:Mrzhanglu,项目名称:ForoneAdministrator,代码行数:31,代码来源:ClearDatabase.php


示例8: getDatabaseConfig

 /**
  * @return array
  */
 public function getDatabaseConfig()
 {
     if (Schema::hasTable('options')) {
         $table = $this->app['db']->table('options');
         return $this->changeConfigWithHelpers($table->where('type', 'config')->lists('value', 'key'));
     }
 }
开发者ID:jayaregalinada,项目名称:common,代码行数:10,代码来源:OptionServiceProvider.php


示例9: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         //
         $table->string('password')->nullable(false)->change();
     });
 }
开发者ID:jarriaga,项目名称:cuandomepagas.com,代码行数:12,代码来源:2016_10_13_003550_set_password_nullable.php


示例10: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('profesor', function (Blueprint $table) {
         $table->integer('pro_tipo');
         $table->timestamps();
     });
 }
开发者ID:Rayotz,项目名称:TiMsRw,代码行数:12,代码来源:2015_12_22_164927_create_profesor_table.php


示例11: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // Oh my word! Cant rename any columns in a table that has an
     // enum. o_0
     //
     // Apply the hacky workaround seen here:
     //  https://github.com/laravel/framework/issues/1186#issuecomment-248853309
     Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
     // Define the tables and columns that need to be changed
     $integer_tables_and_columns = ['character_bookmarks' => ['itemID'], 'eve_conquerable_station_lists' => ['stationID'], 'character_character_sheets' => ['homeStationID'], 'character_contact_lists' => ['labelMask'], 'character_contact_list_labels' => ['labelID'], 'character_contact_list_alliances' => ['labelMask'], 'character_contact_list_alliance_labels' => ['labelID'], 'character_contact_list_corporates' => ['labelMask'], 'character_contact_list_corporate_labels' => ['labelID'], 'character_contracts' => ['startStationID', 'endStationID'], 'character_industry_jobs' => ['stationID', 'blueprintLocationID', 'outputLocationID'], 'character_market_orders' => ['stationID'], 'character_wallet_journals' => ['argID1'], 'character_wallet_transactions' => ['stationID'], 'corporation_bookmarks' => ['itemID'], 'corporation_contact_list_labels' => ['labelID'], 'corporation_contact_lists' => ['labelMask'], 'corporation_contact_list_alliances' => ['labelMask'], 'corporation_contact_list_alliance_labels' => ['labelID'], 'corporation_contracts' => ['startStationID', 'endStationID'], 'corporation_member_securities' => ['roleID'], 'corporation_sheets' => ['stationID'], 'corporation_industry_jobs' => ['stationID', 'blueprintLocationID', 'outputLocationID'], 'corporation_market_orders' => ['stationID'], 'corporation_wallet_journals' => ['argID1'], 'corporation_wallet_transactions' => ['stationID']];
     // Loop over the changes defined in the above array.
     foreach ($integer_tables_and_columns as $table => $columns) {
         Schema::table($table, function (Blueprint $table) use($columns) {
             // Loop over the columns that are passed in and change them
             foreach ($columns as $column) {
                 $table->bigInteger($column)->change();
             }
         });
     }
     // Fix some Wallet values for the industry jobs tables.
     Schema::table('character_industry_jobs', function (Blueprint $table) {
         $table->decimal('cost', 30, 2)->change();
     });
     Schema::table('corporation_industry_jobs', function (Blueprint $table) {
         $table->decimal('cost', 30, 2)->change();
     });
 }
开发者ID:eveseat,项目名称:eveapi,代码行数:32,代码来源:2016_10_20_070644_fix_strictmode_integer_sizes.php


示例12: 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


示例13: 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


示例14: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('administrators', function ($table) {
         $table->dropForeign('administrators_user_id_foreign');
     });
     Schema::drop('administrators');
 }
开发者ID:franciscoBarrientos,项目名称:laravel,代码行数:12,代码来源:2015_12_17_135502_create_administrators_table.php


示例15: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     $tables = ['attached', 'attaches'];
     foreach ($tables as $table) {
         Schema::dropIfExists($table);
     }
 }
开发者ID:AngryDeer,项目名称:Attachfiles,代码行数:12,代码来源:2016_01_30_014754_angrydeer_attachfiles_create_tables.php


示例16: 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


示例17: test_tables_exist

 /**
  * Ensures the migrations ran and tables exist in the database.
  */
 public function test_tables_exist()
 {
     $expectedTables = ['users', 'password_resets', 'email_addresses', 'phone_numbers', 'addresses'];
     foreach ($expectedTables as $table) {
         $this->assertTrue(Schema::hasTable($table));
     }
 }
开发者ID:autocar,项目名称:contactable,代码行数:10,代码来源:DatabaseTables.php


示例18: createSchema

 public function createSchema()
 {
     if (!DbSchema::hasTable('sessions')) {
         try {
             DbSchema::create('sessions', function ($table) {
                 $table->string('id')->unique();
                 $table->longText('payload');
                 $table->integer('last_activity');
             });
         } catch (QueryException $e) {
         }
     }
     $exec = $this->getSystemSchemas();
     $builder = new DbUtils();
     foreach ($exec as $data) {
         // Creates the schema
         if (!method_exists($data, 'get')) {
             break;
         }
         $schemaArray = $data->get();
         if (!is_array($schemaArray)) {
             break;
         }
         foreach ($schemaArray as $table => $columns) {
             $builder->build_table($table, $columns);
         }
     }
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:28,代码来源:DbInstaller.php


示例19: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('languages', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->string('short_two');
         $table->string('short_three');
         $table->timestamps();
     });
     Schema::create('groups', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('group_id')->nullable()->comment('Refer to self for multidimensional groups');
         $table->timestamps();
     });
     Schema::create('names', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('group_id');
         $table->timestamps();
     });
     Schema::create('values', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('language_id');
         $table->integer('name_id');
         $table->timestamps();
     });
 }
开发者ID:donny5300,项目名称:translations,代码行数:34,代码来源:2016_05_23_160820_create_translations_table.php


示例20: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     if (Schema::hasTable('categories')) {
         $categories = Category::getAllFromCache();
         view()->share('categories', $categories);
     }
 }
开发者ID:mikolajszczepanski,项目名称:NuPtr,代码行数:12,代码来源:CategoryServiceProvider.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Facades\Session类代码示例发布时间:2022-05-23
下一篇:
PHP Facades\Route类代码示例发布时间: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