src/Gzero/Cms/CMSSeeder.php
private function seedRandomContent(string $type, $parent, $languages, $users)
    {
        $user  = $users->random();
        $en    = $languages['en'];
        $pl    = $languages['pl'];
        $faker = Factory::create($en->i18n);
        $title = $faker->realText(38, 1);

        $content = dispatch_now(CreateContent::make($title, $en, $user, array_merge(
            [
                'type'               => $type,
                'parent_id'          => array_get($parent, 'id', null),
                'weight'             => rand(0, 10),
                'rating'             => rand(0, 5),
                'is_on_home'         => (bool) rand(0, 1),
                'is_comment_allowed' => (bool) rand(0, 1),
                'is_promoted'        => (bool) rand(0, 1),
                'is_sticky'          => (bool) rand(0, 1),
                'is_active'          => (bool) rand(0, 1),
                'published_at'       => Carbon::now()
            ],
            $this->generateContentTranslation($en)
        )));

        $faker = Factory::create($pl->i18n);
        $title = $faker->realText(38, 1);
        dispatch_now(new AddContentTranslation($content, $title, $pl, $user, $this->generateContentTranslation($pl)));

        return $content;
    }
private function seedRandomContent(string $type, $parent, $languages, $users)
    {
        $user  = $users->random();
        $en    = $languages['en'];
        $pl    = $languages['pl'];
        $faker = Factory::create($en->i18n);
        $title = $faker->realText(38, 1);

        $content = dispatch_now(CreateContent::make($title, $en, $user, array_merge(
            [
                'type'               => $type,
                'parent_id'          => array_get($parent, 'id', null),
                'weight'             => rand(0, 10),
                'rating'             => rand(0, 5),
                'is_on_home'         => (bool) rand(0, 1),
                'is_comment_allowed' => (bool) rand(0, 1),
                'is_promoted'        => (bool) rand(0, 1),
                'is_sticky'          => (bool) rand(0, 1),
                'is_active'          => (bool) rand(0, 1),
                'published_at'       => Carbon::now()
            ],
            $this->generateContentTranslation($en)
        )));

        $faker = Factory::create($pl->i18n);
        $title = $faker->realText(38, 1);
        dispatch_now(new AddContentTranslation($content, $title, $pl, $user, $this->generateContentTranslation($pl)));

        return $content;
    }
private function seedRandomContent ( string $ type , $ parent , $ languages , $ users ) { $ user = $ users -> random ( ) ; $ en = $ languages [ 'en' ] ; $ pl = $ languages [ 'pl' ] ; $ faker = Factory :: create ( $ en -> i18n ) ; $ title = $ faker -> realText ( 38 , 1 ) ; $ content = dispatch_now ( CreateContent :: make ( $ title , $ en , $ user , array_merge ( [ 'type' => $ type , 'parent_id' => array_get ( $ parent , 'id' , null ) , 'weight' => rand ( 0 , 10 ) , 'rating' => rand ( 0 , 5 ) , 'is_on_home' => ( bool ) rand ( 0 , 1 ) , 'is_comment_allowed' => ( bool ) rand ( 0 , 1 ) , 'is_promoted' => ( bool ) rand ( 0 , 1 ) , 'is_sticky' => ( bool ) rand ( 0 , 1 ) , 'is_active' => ( bool ) rand ( 0 , 1 ) , 'published_at' => Carbon :: now ( ) ] , $ this -> generateContentTranslation ( $ en ) ) ) ) ; $ faker = Factory :: create ( $ pl -> i18n ) ; $ title = $ faker -> realText ( 38 , 1 ) ; dispatch_now ( new AddContentTranslation ( $ content , $ title , $ pl , $ user , $ this -> generateContentTranslation ( $ pl ) ) ) ; return $ content ; }
Seed single content

@param string       $type      Content type
@param Content|Null $parent    Parent element
@param array        $languages Array with languages
@param array        $users     Array with users

@return bool
Seed single content