Schema::getColumnType PHP Method

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
        public static function getColumnType($table, $column)
        {
            //Method inherited from \Illuminate\Database\Schema\Builder
            return \Illuminate\Database\Schema\MySqlBuilder::getColumnType($table, $column);
        }

Usage Example

Example #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) {
All Usage Examples Of Schema::getColumnType