src/Gzero/Cms/CMSSeeder.php
private function seedRandomBlock(BlockType $type, $languages, $users, $contents)
    {
        $language    = $languages->random();
        $faker       = Factory::create($language->i18n);
        $isActive    = (bool) rand(0, 1);
        $isCacheable = (bool) rand(0, 1);
        $filter      = (rand(0, 1)) ? [
            '+' => [$this->getRandomBlockFilter($contents)],
            '-' => [$this->getRandomBlockFilter($contents)]
        ] : null;
        $input       = [
            'type'          => $type->name,
            'region'        => $this->getRandomBlockRegion(),
            'weight'        => rand(0, 12),
            'filter'        => $filter,
            'options'       => array_combine($this->faker->words(), $this->faker->words()),
            'is_active'     => $isActive,
            'is_cacheable'  => $isCacheable,
            'translations'  => $this->prepareBlockTranslation($languages['en']),
            'body'          => $faker->realText(300),
            'custom_fields' => array_combine($this->faker->words(), $this->faker->words()),
        ];

        $block = dispatch_now(CreateBlock::make($faker->realText(38, 1), $language, $users->random(), $input));

        return $block;
    }
private function seedRandomBlock(BlockType $type, $languages, $users, $contents)
    {
        $language    = $languages->random();
        $faker       = Factory::create($language->i18n);
        $isActive    = (bool) rand(0, 1);
        $isCacheable = (bool) rand(0, 1);
        $filter      = (rand(0, 1)) ? [
            '+' => [$this->getRandomBlockFilter($contents)],
            '-' => [$this->getRandomBlockFilter($contents)]
        ] : null;
        $input       = [
            'type'          => $type->name,
            'region'        => $this->getRandomBlockRegion(),
            'weight'        => rand(0, 12),
            'filter'        => $filter,
            'options'       => array_combine($this->faker->words(), $this->faker->words()),
            'is_active'     => $isActive,
            'is_cacheable'  => $isCacheable,
            'translations'  => $this->prepareBlockTranslation($languages['en']),
            'body'          => $faker->realText(300),
            'custom_fields' => array_combine($this->faker->words(), $this->faker->words()),
        ];

        $block = dispatch_now(CreateBlock::make($faker->realText(38, 1), $language, $users->random(), $input));

        return $block;
    }
private function seedRandomBlock ( BlockType $ type , $ languages , $ users , $ contents ) { $ language = $ languages -> random ( ) ; $ faker = Factory :: create ( $ language -> i18n ) ; $ isActive = ( bool ) rand ( 0 , 1 ) ; $ isCacheable = ( bool ) rand ( 0 , 1 ) ; $ filter = ( rand ( 0 , 1 ) ) ? [ '+' => [ $ this -> getRandomBlockFilter ( $ contents ) ] , '-' => [ $ this -> getRandomBlockFilter ( $ contents ) ] ] : null ; $ input = [ 'type' => $ type -> name , 'region' => $ this -> getRandomBlockRegion ( ) , 'weight' => rand ( 0 , 12 ) , 'filter' => $ filter , 'options' => array_combine ( $ this -> faker -> words ( ) , $ this -> faker -> words ( ) ) , 'is_active' => $ isActive , 'is_cacheable' => $ isCacheable , 'translations' => $ this -> prepareBlockTranslation ( $ languages [ 'en' ] ) , 'body' => $ faker -> realText ( 300 ) , 'custom_fields' => array_combine ( $ this -> faker -> words ( ) , $ this -> faker -> words ( ) ) , ] ; $ block = dispatch_now ( CreateBlock :: make ( $ faker -> realText ( 38 , 1 ) , $ language , $ users -> random ( ) , $ input ) ) ; return $ block ; }
Seed single block

@param BlockType $type      Block type
@param array     $languages Array with languages
@param array     $users     Array with users
@param array     $contents  Array with contents

@return Block
Seed single block