database/seeders/BrandSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $brands = ['Apple', 'Huawei', 'Oppo', 'Samsung', 'Xiaomi', 'Vivo'];
        for ($i = 0; $i < count($brands); $i++) {
            $brand = new Brand;
            $brand->name_en = $brands[$i];
            $brand->name_id = $brands[$i];
            $brand->slug_en = strtolower($brands[$i]);
            $brand->slug_id = strtolower($brands[$i]);
            $brand->image = 'upload/brand/brand' . $i . '.png';
            $brand->save();
        }
    }
public function run ( ) { $ brands = [ 'Apple' , 'Huawei' , 'Oppo' , 'Samsung' , 'Xiaomi' , 'Vivo' ] ; for ( $ i = 0 ; $ i < count ( $ brands ) ; $ i ++ ) { $ brand = new Brand ; $ brand -> name_en = $ brands [ $ i ] ; $ brand -> name_id = $ brands [ $ i ] ; $ brand -> slug_en = strtolower ( $ brands [ $ i ] ) ; $ brand -> slug_id = strtolower ( $ brands [ $ i ] ) ; $ brand -> image = 'upload/brand/brand' . $ i . '.png' ; $ brand -> save ( ) ; } }
Run the database seeds.
Run the database seeds .