#1879 Ürün seçenekleri ve GET seçenekleri

This commit is contained in:
Muammer Top 2020-10-23 18:24:49 +03:00
parent 40fa8899ab
commit c764f6f5ea
11 changed files with 65 additions and 39 deletions

View File

@ -15,7 +15,7 @@ class VisiosoftModuleAdvsCreateProductoptionsStream extends Migration
protected $delete = true;
protected $fields = [
'categories' => [
'category' => [
'type' => 'anomaly.field_type.select',
'config' => [
'handler' => 'Visiosoft\AdvsModule\OptionHandler\CategoriesOptions@handle'
@ -43,7 +43,7 @@ class VisiosoftModuleAdvsCreateProductoptionsStream extends Migration
* @var array
*/
protected $assignments = [
'categories',
'category',
'name' => [
'translatable' => true,
'required' => true,

View File

@ -137,7 +137,9 @@ return [
'oldest' => 'Oldest',
'address_a_z' => 'Address (A to Z)',
'address_z_a' => 'Address (Z to A)',
'categories' => 'Categories',
'categories' => [
'name' => 'Categories'
],
'all_categories' => 'All Categories',
'location' => 'Location',
'send_message' => 'Send Message',

View File

@ -46,18 +46,12 @@ return [
],
'ads_image' => 'Ads Image',
'product_options' => [
'title' => 'Product Options',
'title' => 'Options',
],
'productoptions_value' => [
'title' => 'Productoptions value',
],
'options_configuration' => [
'title' => 'Options configuration',
'title' => 'Options Value',
],
'option_configuration' => [
'title' => 'Option configuration',
],
'option_configuration' => [
'title' => 'Option configuration',
'title' => 'Configuration',
],
];

View File

@ -23,18 +23,12 @@ return [
'name' => 'Options',
],
'product_options' => [
'name' => 'Produc Options',
'name' => 'Product Options',
],
'productoptions_value' => [
'name' => 'Productoptions value',
],
'options_configuration' => [
'name' => 'Options configuration',
'name' => 'Options value',
],
'option_configuration' => [
'name' => 'Option configuration',
],
'option_configuration' => [
'name' => 'Option configuration',
'name' => 'Configuration',
],
];

View File

@ -15,7 +15,7 @@ class CategoriesOptions
public function handle(SelectFieldType $fieldType)
{
$categories = $this->categoryRepository->mainCats();
$options[] = $categories->pluck('name', 'id');
$options = $categories->pluck('name', 'id')->all();
$fieldType->setOptions($options);
}
}

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface ProductoptionRepositoryInterface extends EntryRepositoryInterface
{
public function getWithCategoryId($id);
}

View File

@ -22,4 +22,9 @@ class ProductoptionRepository extends EntryRepository implements ProductoptionRe
{
$this->model = $model;
}
public function getWithCategoryId($id)
{
return $this->findAllBy('category',$id);
}
}

View File

@ -1,10 +1,22 @@
<?php namespace Visiosoft\AdvsModule\Productoption\Table;
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
class ProductoptionTableBuilder extends TableBuilder
{
public function setTableEntries(\Illuminate\Support\Collection $entries)
{
$option_repository = app(ProductoptionRepositoryInterface::class);
$value_repository = app(ProductoptionsValueRepositoryInterface::class);
$options_id = $option_repository->getWithCategoryId(7)->pluck('id')->all();
$values = $value_repository->getWithOptionsId($options_id);
return parent::setTableEntries($values);
}
/**
* The table views.
*

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface ProductoptionsValueRepositoryInterface extends EntryRepositoryInterface
{
public function getWithOptionsId(array $ids);
}

View File

@ -6,20 +6,25 @@ use Anomaly\Streams\Platform\Entry\EntryRepository;
class ProductoptionsValueRepository extends EntryRepository implements ProductoptionsValueRepositoryInterface
{
/**
* The entry model.
*
* @var ProductoptionsValueModel
*/
protected $model;
/**
* The entry model.
*
* @var ProductoptionsValueModel
*/
protected $model;
/**
* Create a new ProductoptionsValueRepository instance.
*
* @param ProductoptionsValueModel $model
*/
public function __construct(ProductoptionsValueModel $model)
{
$this->model = $model;
}
/**
* Create a new ProductoptionsValueRepository instance.
*
* @param ProductoptionsValueModel $model
*/
public function __construct(ProductoptionsValueModel $model)
{
$this->model = $model;
}
public function getWithOptionsId(array $ids)
{
return $this->newQuery()->whereIn('product_option_id', $ids)->get();
}
}

View File

@ -1,5 +1,9 @@
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
use Illuminate\Database\Eloquent\Builder;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
/**
* Class LookupTableBuilder
*
@ -9,6 +13,16 @@
*/
class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
{
public function setTableEntries(\Illuminate\Support\Collection $entries)
{
$option_repository = app(ProductoptionRepositoryInterface::class);
$value_repository = app(ProductoptionsValueRepositoryInterface::class);
$options_id = $option_repository->getWithCategoryId(7)->pluck('id')->all();
$values = $value_repository->getWithOptionsId($options_id);
return parent::setTableEntries($values);
}
protected $filters = [
'product_option'