database/seeds/CategoriesTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        PHP Category
        DB::table('categories')->insert([
            'parent_id' => '0',
            'name' => 'PHP'
        ]);
        JavaScript Category
        DB::table('categories')->insert([
            'parent_id' => '0',
            'name' => 'JavaScript'
        ]);
        PHP Sub-Category
        DB::table('categories')->insert([
            'parent_id' => '1',
            'name' => 'Laravel'
        ]);
        PHP Sub-Category
        DB::table('categories')->insert([
            'parent_id' => '1',
            'name' => 'CodeIgniter'
        ]);
        JavaScript Sub-Category
        DB::table('categories')->insert([
            'parent_id' => '2',
            'name' => 'Angular'
        ]);
        JavaScript Sub-Category
        DB::table('categories')->insert([
            'parent_id' => '2',
            'name' => 'React'
        ]);
    }
public function run ( ) { DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '0' , 'name' => 'PHP' ] ) ; DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '0' , 'name' => 'JavaScript' ] ) ; DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '1' , 'name' => 'Laravel' ] ) ; DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '1' , 'name' => 'CodeIgniter' ] ) ; DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '2' , 'name' => 'Angular' ] ) ; DB :: table ( 'categories' ) -> insert ( [ 'parent_id' => '2' , 'name' => 'React' ] ) ; }
Run the database seeds.
Run the database seeds .
// //PHP Category //JavaScript Category //PHP Sub-Category //PHP Sub-Category //JavaScript Sub-Category //JavaScript Sub-Category