database/seeds/CommentaryTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $categories = [];
        $cName = 'No Category';
        $categories[] = [
            'title'     => $cName,
            'slug'      => Str::slug($cName),  поучить что такое
            'parent_id' => 0,
        ];
        for($i = 2; $i <= 11; $i++){
            $cName = 'Category #'.$i;
            $parent_id = ($i > 4) ? rand(1,4) : 1;
            $categories[] = [
                'title'     => $cName,
                'slug'      => Str::slug($cName),
                'parent_id' => $parent_id,
            ];
        }
        \DB::table('blog_categories')->insert($categories);
    }
public function run ( ) { $ categories = [ ] ; $ cName = 'No Category' ; $ categories [ ] = [ 'title' => $ cName , 'slug' => Str :: slug ( $ cName ) , 'parent_id' => 0 , ] ; for ( $ i = 2 ; $ i <= 11 ; $ i ++ ) { $ cName = 'Category #' . $ i ; $ parent_id = ( $ i > 4 ) ? rand ( 1 , 4 ) : 1 ; $ categories [ ] = [ 'title' => $ cName , 'slug' => Str :: slug ( $ cName ) , 'parent_id' => $ parent_id , ] ; } \ DB :: table ( 'blog_categories' ) -> insert ( $ categories ) ; }
Run the database seeds.
Run the database seeds .
// // поучить что такое