當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Facades\Schema類代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Schema的典型用法代碼示例。如果您正苦於以下問題:PHP Schema類的具體用法?PHP Schema怎麽用?PHP Schema使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Schema類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Illuminate\Support\Facades\Schema類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。