sarga/packages/Webkul/Attribute/src/Database/Seeders/AttributeFamilyTableSeeder.php

146 lines
4.7 KiB
PHP
Raw Normal View History

2018-07-27 06:22:12 +00:00
<?php
namespace Webkul\Attribute\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
class AttributeFamilyTableSeeder extends Seeder
{
/**
* @var array
*/
protected $rawData = [
[
"code" => "default",
"name" => "Default",
"is_user_defined" => 0,
'attribute_groups' => [
[
"name" => "General",
"is_user_defined" => 0,
"position" => 1,
2018-08-17 05:48:21 +00:00
"custom_attributes" => [
2018-07-27 06:22:12 +00:00
[
2018-07-27 09:30:48 +00:00
'code' => 'sku',
2018-07-27 06:22:12 +00:00
'position' => 1
], [
2018-07-27 09:30:48 +00:00
'code' => 'name',
2018-07-27 06:22:12 +00:00
'position' => 2
], [
2018-07-27 09:30:48 +00:00
'code' => 'url_key',
2018-07-27 06:22:12 +00:00
'position' => 3
], [
2018-07-27 09:30:48 +00:00
'code' => 'new_from',
2018-07-27 06:22:12 +00:00
'position' => 4
], [
2018-07-27 09:30:48 +00:00
'code' => 'new_to',
2018-07-27 06:22:12 +00:00
'position' => 5
2018-07-27 09:30:48 +00:00
], [
2018-08-09 04:35:13 +00:00
'code' => 'visible_individually',
2018-07-27 09:30:48 +00:00
'position' => 6
2018-08-09 04:35:13 +00:00
], [
'code' => 'status',
'position' => 7
2018-07-27 06:22:12 +00:00
]
]
], [
"name" => "Description",
"is_user_defined" => 0,
"position" => 2,
2018-08-17 05:48:21 +00:00
"custom_attributes" => [
2018-07-27 06:22:12 +00:00
[
'code' => 'short_description',
'position' => 1
], [
'code' => 'description',
'position' => 2
]
]
], [
"name" => "Meta Description",
"is_user_defined" => 0,
"position" => 3,
2018-08-17 05:48:21 +00:00
"custom_attributes" => [
2018-07-27 06:22:12 +00:00
[
'code' => 'meta_title',
'position' => 1
], [
'code' => 'meta_keywords',
'position' => 2
], [
'code' => 'meta_description',
'position' => 3
]
]
], [
"name" => "Price",
"is_user_defined" => 0,
"position" => 4,
2018-08-17 05:48:21 +00:00
"custom_attributes" => [
2018-07-27 06:22:12 +00:00
[
'code' => 'price',
'position' => 1
], [
'code' => 'cost',
'position' => 2
], [
'code' => 'special_price',
'position' => 3
], [
'code' => 'special_price_from',
'position' => 4
], [
'code' => 'special_price_to',
'position' => 5
]
]
], [
"name" => "Shipping",
"is_user_defined" => 0,
"position" => 5,
2018-08-17 05:48:21 +00:00
"custom_attributes" => [
2018-07-27 06:22:12 +00:00
[
'code' => 'width',
'position' => 1
], [
'code' => 'height',
'position' => 2
], [
'code' => 'depth',
'position' => 3
], [
'code' => 'weight',
'position' => 4
]
]
]
]
]
];
/**
* AttributeFamilyRepository object
*
* @var array
*/
protected $attributeFamily;
/**
* Create a new controller instance.
*
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
* @return void
*/
public function __construct(AttributeFamilyRepository $attributeFamily)
{
$this->attributeFamily = $attributeFamily;
}
public function run()
{
foreach($this->rawData as $row) {
$this->attributeFamily->create($row);
}
}
}