src/Shell/SeedShell.php
protected function getFieldValueBasedOnType(string $type, string $moduleName = '', string $listName = '')
    {
        $faker = Factory::create();

        $value = null;

        switch ($type) {
            case 'uuid':
                $value = $faker->unique()->uuid;
                break;
            case 'url':
                $value = $faker->url;
                break;
            case 'time':
                $value = $faker->unique()->time('HH:mm');
                break;
            case 'string':
                $value = $faker->unique()->text(20);
                break;
            case 'text':
                $value = $faker->unique()->paragraph();
                break;
            case 'phone':
                $value = $faker->unique()->phoneNumber;
                break;
            case 'decimal':
                $value = $faker->unique()->randomFloat();
                break;
            case 'integer':
                $value = $faker->unique()->numberBetween();
                break;
            case 'email':
                $value = $faker->unique()->email;
                break;
            case 'datetime':
            case 'reminder':
                $value = $faker->unique()->dateTime('yyyy-MM-dd HH:mm:ss');
                break;
            case 'date':
                $value = $faker->unique()->date('yyyy-MM-dd');
                break;
            case 'boolean':
                $value = $faker->unique()->boolean();
                break;
            default:
                if (strpos($type, 'list') !== false || strpos($type, 'money') !== false || strpos($type, 'metric') !== false) {
                    //get list values
                    if (empty($listName)) {
                        $listName = $this->getStringEnclosedInParenthesis($type);
                    }
                    $list = $this->getListData($moduleName, $listName);
                    if (empty($list) || count($list) == 0) {
                        $value = null;
                        break;
                    }
                    $value = $faker->randomElement($list);
                }
                if (strpos($type, 'related') !== false) {
                    //get list values
                    $moduleName = $this->getStringEnclosedInParenthesis($type);
                    $list = $this->getModuleIds($moduleName);
                    if (empty($list) || count($list) == 0) {
                        $value = null;
                        break;
                    }
                    $value = $faker->randomElement($list);
                }
        }

        return $value;
    }
protected function getFieldValueBasedOnType(string $type, string $moduleName = '', string $listName = '')
    {
        $faker = Factory::create();

        $value = null;

        switch ($type) {
            case 'uuid':
                $value = $faker->unique()->uuid;
                break;
            case 'url':
                $value = $faker->url;
                break;
            case 'time':
                $value = $faker->unique()->time('HH:mm');
                break;
            case 'string':
                $value = $faker->unique()->text(20);
                break;
            case 'text':
                $value = $faker->unique()->paragraph();
                break;
            case 'phone':
                $value = $faker->unique()->phoneNumber;
                break;
            case 'decimal':
                $value = $faker->unique()->randomFloat();
                break;
            case 'integer':
                $value = $faker->unique()->numberBetween();
                break;
            case 'email':
                $value = $faker->unique()->email;
                break;
            case 'datetime':
            case 'reminder':
                $value = $faker->unique()->dateTime('yyyy-MM-dd HH:mm:ss');
                break;
            case 'date':
                $value = $faker->unique()->date('yyyy-MM-dd');
                break;
            case 'boolean':
                $value = $faker->unique()->boolean();
                break;
            default:
                if (strpos($type, 'list') !== false || strpos($type, 'money') !== false || strpos($type, 'metric') !== false) {
                    //get list values
                    if (empty($listName)) {
                        $listName = $this->getStringEnclosedInParenthesis($type);
                    }
                    $list = $this->getListData($moduleName, $listName);
                    if (empty($list) || count($list) == 0) {
                        $value = null;
                        break;
                    }
                    $value = $faker->randomElement($list);
                }
                if (strpos($type, 'related') !== false) {
                    //get list values
                    $moduleName = $this->getStringEnclosedInParenthesis($type);
                    $list = $this->getModuleIds($moduleName);
                    if (empty($list) || count($list) == 0) {
                        $value = null;
                        break;
                    }
                    $value = $faker->randomElement($list);
                }
        }

        return $value;
    }
protected function getFieldValueBasedOnType ( string $ type , string $ moduleName = '' , string $ listName = '' ) { $ faker = Factory :: create ( ) ; $ value = null ; switch ( $ type ) { case 'uuid' : $ value = $ faker -> unique ( ) -> uuid ; break ; case 'url' : $ value = $ faker -> url ; break ; case 'time' : $ value = $ faker -> unique ( ) -> time ( 'HH:mm' ) ; break ; case 'string' : $ value = $ faker -> unique ( ) -> text ( 20 ) ; break ; case 'text' : $ value = $ faker -> unique ( ) -> paragraph ( ) ; break ; case 'phone' : $ value = $ faker -> unique ( ) -> phoneNumber ; break ; case 'decimal' : $ value = $ faker -> unique ( ) -> randomFloat ( ) ; break ; case 'integer' : $ value = $ faker -> unique ( ) -> numberBetween ( ) ; break ; case 'email' : $ value = $ faker -> unique ( ) -> email ; break ; case 'datetime' : case 'reminder' : $ value = $ faker -> unique ( ) -> dateTime ( 'yyyy-MM-dd HH:mm:ss' ) ; break ; case 'date' : $ value = $ faker -> unique ( ) -> date ( 'yyyy-MM-dd' ) ; break ; case 'boolean' : $ value = $ faker -> unique ( ) -> boolean ( ) ; break ; default : if ( strpos ( $ type , 'list' ) !== false || strpos ( $ type , 'money' ) !== false || strpos ( $ type , 'metric' ) !== false ) { //get list values if ( empty ( $ listName ) ) { $ listName = $ this -> getStringEnclosedInParenthesis ( $ type ) ; } $ list = $ this -> getListData ( $ moduleName , $ listName ) ; if ( empty ( $ list ) || count ( $ list ) == 0 ) { $ value = null ; break ; } $ value = $ faker -> randomElement ( $ list ) ; } if ( strpos ( $ type , 'related' ) !== false ) { //get list values $ moduleName = $ this -> getStringEnclosedInParenthesis ( $ type ) ; $ list = $ this -> getModuleIds ( $ moduleName ) ; if ( empty ( $ list ) || count ( $ list ) == 0 ) { $ value = null ; break ; } $ value = $ faker -> randomElement ( $ list ) ; } } return $ value ; }
Get field value based on type.

@param string $type type.
@param string $moduleName module name.
@param string $listName listName.
@return mixed
Get field value based on type .