本文整理汇总了PHP中Schema::getColumnType方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::getColumnType方法的具体用法?PHP Schema::getColumnType怎么用?PHP Schema::getColumnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::getColumnType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
| $request - The form requrest information |
| |
+---------------------------------------------------------------------------+
| |
| This files saves the new information to the database | |
| |
+---------------------------------------------------------------------------+
*/
include 'Get.php';
# Validate The Request
$this->validate($request, $validator);
# Update the row
foreach ($fields as $field) {
$save = true;
# Check the field type
$type = Schema::getColumnType($table, $field);
# Get the value
$value = $request->input($field);
if ($type == 'string' or $type == 'integer') {
# Check if it's a default_random field
foreach ($default_random as $random) {
if ($random == $field) {
if (!$value) {
$value = str_random(10);
}
}
}
# Check if it's a hashed field
foreach ($hashed as $hash) {
if ($hash == $field) {
if ($value) {
示例2: define
<?php
\Larakit\CRUD\CrudRow::register(\Larakit\Models\Entity::class, '/admincp/entities');
define('ROUTE_ADMIN_CODEGEN', 'larakit::admin.codegen');
\Larakit\Route\Route::item(ROUTE_ADMIN_CODEGEN)->setBaseUrl('/admincp/generator')->put()->addSegment('{model}')->put();
define('ROUTE_ADMIN', 'larakit::admin');
\Larakit\Route\Route::item(ROUTE_ADMIN)->setBaseUrl('/admincp/')->put();
\Adminlte\Widget\WidgetSidebarMenu::group('ГЕНЕРАТОР КОДА')->addItem('codegen', 'Модели', ROUTE_ADMIN_CODEGEN);
return;
$ret = [];
foreach (Schema::getColumnListing('bmmaket-core__recommend_groups') as $name) {
$ret[$name] = Schema::getColumnType('bmmaket-core__recommend_groups', $name);
}
dd($ret);
dd(DB::table('bmmaket-core__recommend_groups'));