Mojopollo\Schema\MakeMigrationJson::isValidColumnType PHP Метод

isValidColumnType() публичный Метод

Checks if supplied string argument is a valid column type
См. также: https://laravel.com/docs/5.2/migrations#creating-columns
public isValidColumnType ( string $type ) : boolean
$type string Example: string, integer, text, timestamp, etc
Результат boolean Returns true if valid, otherwise false
    public function isValidColumnType($type)
    {
        // Check if this is a valid method in the Blueprint class
        return method_exists($this->blueprint, $type);
    }

Usage Example

 /**
  * Test isValidColumnType()
  *
  * @return void
  */
 public function testIsValidColumnType()
 {
     // The following column type should fail
     $types = ['purpleRain', 'masterBlaster'];
     foreach ($types as $type) {
         $this->assertFalse($this->makeMigrationJson->isValidColumnType($type), "'{$type}' should not be a valid column type");
     }
     // The following column types should pass
     $types = ['string', 'integer', 'bigInteger', 'morphs', 'mediumText', 'timestamp'];
     foreach ($types as $type) {
         $this->assertTrue($this->makeMigrationJson->isValidColumnType($type), "'{$type}' should be a valid column type");
     }
 }