getColumnType() public static method

Get the data type for the given column name.
public static getColumnType ( string $table, string $column ) : string
$table string
$column string
return string
Exemplo n.º 1
0
| $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) {
Exemplo n.º 2
0
<?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'));