database/seeds/BlogCategorySeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $categories = collect([
        		'Fashion',
        		'Beauty',
        		'Lifestyle',
        		'Technology',
        		'Marketing',
        		'Education',
        		'Design',
        		'Travel',
        		'DIY',
        		'Career',
        		'Automobile',
        		'Fitness and Health',
        		'Sports',
        		'Entertainment',
        		'Humor',
        		'Photography'
        	]);
        $categories->each(function($item, $key){
        	$check = Category::where('category', $item)->get();
        	if(!$check->count()){
        		Category::create([
        			'category'	=> $item,
        			'slug'		=> str_slug($item)
        		]);
        	}
        });
    }
public function run ( ) { $ categories = collect ( [ 'Fashion' , 'Beauty' , 'Lifestyle' , 'Technology' , 'Marketing' , 'Education' , 'Design' , 'Travel' , 'DIY' , 'Career' , 'Automobile' , 'Fitness and Health' , 'Sports' , 'Entertainment' , 'Humor' , 'Photography' ] ) ; $ categories -> each ( function ( $ item , $ key ) { $ check = Category :: where ( 'category' , $ item ) -> get ( ) ; if ( ! $ check -> count ( ) ) { Category :: create ( [ 'category' => $ item , 'slug' => str_slug ( $ item ) ] ) ; } } ) ; }
Run the database seeds.
Run the database seeds .