mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
#1879 Ürün seçenekleri ve GET seçenekleri
This commit is contained in:
parent
40fa8899ab
commit
c764f6f5ea
@ -15,7 +15,7 @@ class VisiosoftModuleAdvsCreateProductoptionsStream extends Migration
|
|||||||
protected $delete = true;
|
protected $delete = true;
|
||||||
|
|
||||||
protected $fields = [
|
protected $fields = [
|
||||||
'categories' => [
|
'category' => [
|
||||||
'type' => 'anomaly.field_type.select',
|
'type' => 'anomaly.field_type.select',
|
||||||
'config' => [
|
'config' => [
|
||||||
'handler' => 'Visiosoft\AdvsModule\OptionHandler\CategoriesOptions@handle'
|
'handler' => 'Visiosoft\AdvsModule\OptionHandler\CategoriesOptions@handle'
|
||||||
@ -43,7 +43,7 @@ class VisiosoftModuleAdvsCreateProductoptionsStream extends Migration
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $assignments = [
|
protected $assignments = [
|
||||||
'categories',
|
'category',
|
||||||
'name' => [
|
'name' => [
|
||||||
'translatable' => true,
|
'translatable' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
|||||||
@ -137,7 +137,9 @@ return [
|
|||||||
'oldest' => 'Oldest',
|
'oldest' => 'Oldest',
|
||||||
'address_a_z' => 'Address (A to Z)',
|
'address_a_z' => 'Address (A to Z)',
|
||||||
'address_z_a' => 'Address (Z to A)',
|
'address_z_a' => 'Address (Z to A)',
|
||||||
'categories' => 'Categories',
|
'categories' => [
|
||||||
|
'name' => 'Categories'
|
||||||
|
],
|
||||||
'all_categories' => 'All Categories',
|
'all_categories' => 'All Categories',
|
||||||
'location' => 'Location',
|
'location' => 'Location',
|
||||||
'send_message' => 'Send Message',
|
'send_message' => 'Send Message',
|
||||||
|
|||||||
@ -46,18 +46,12 @@ return [
|
|||||||
],
|
],
|
||||||
'ads_image' => 'Ads Image',
|
'ads_image' => 'Ads Image',
|
||||||
'product_options' => [
|
'product_options' => [
|
||||||
'title' => 'Product Options',
|
'title' => 'Options',
|
||||||
],
|
],
|
||||||
'productoptions_value' => [
|
'productoptions_value' => [
|
||||||
'title' => 'Productoptions value',
|
'title' => 'Options Value',
|
||||||
],
|
|
||||||
'options_configuration' => [
|
|
||||||
'title' => 'Options configuration',
|
|
||||||
],
|
],
|
||||||
'option_configuration' => [
|
'option_configuration' => [
|
||||||
'title' => 'Option configuration',
|
'title' => 'Configuration',
|
||||||
],
|
|
||||||
'option_configuration' => [
|
|
||||||
'title' => 'Option configuration',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -23,18 +23,12 @@ return [
|
|||||||
'name' => 'Options',
|
'name' => 'Options',
|
||||||
],
|
],
|
||||||
'product_options' => [
|
'product_options' => [
|
||||||
'name' => 'Produc Options',
|
'name' => 'Product Options',
|
||||||
],
|
],
|
||||||
'productoptions_value' => [
|
'productoptions_value' => [
|
||||||
'name' => 'Productoptions value',
|
'name' => 'Options value',
|
||||||
],
|
|
||||||
'options_configuration' => [
|
|
||||||
'name' => 'Options configuration',
|
|
||||||
],
|
],
|
||||||
'option_configuration' => [
|
'option_configuration' => [
|
||||||
'name' => 'Option configuration',
|
'name' => 'Configuration',
|
||||||
],
|
|
||||||
'option_configuration' => [
|
|
||||||
'name' => 'Option configuration',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class CategoriesOptions
|
|||||||
public function handle(SelectFieldType $fieldType)
|
public function handle(SelectFieldType $fieldType)
|
||||||
{
|
{
|
||||||
$categories = $this->categoryRepository->mainCats();
|
$categories = $this->categoryRepository->mainCats();
|
||||||
$options[] = $categories->pluck('name', 'id');
|
$options = $categories->pluck('name', 'id')->all();
|
||||||
$fieldType->setOptions($options);
|
$fieldType->setOptions($options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
|
|
||||||
interface ProductoptionRepositoryInterface extends EntryRepositoryInterface
|
interface ProductoptionRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
public function getWithCategoryId($id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,4 +22,9 @@ class ProductoptionRepository extends EntryRepository implements ProductoptionRe
|
|||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWithCategoryId($id)
|
||||||
|
{
|
||||||
|
return $this->findAllBy('category',$id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,22 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Productoption\Table;
|
<?php namespace Visiosoft\AdvsModule\Productoption\Table;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
class ProductoptionTableBuilder extends TableBuilder
|
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.
|
* The table views.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|||||||
|
|
||||||
interface ProductoptionsValueRepositoryInterface extends EntryRepositoryInterface
|
interface ProductoptionsValueRepositoryInterface extends EntryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
public function getWithOptionsId(array $ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,20 +6,25 @@ use Anomaly\Streams\Platform\Entry\EntryRepository;
|
|||||||
class ProductoptionsValueRepository extends EntryRepository implements ProductoptionsValueRepositoryInterface
|
class ProductoptionsValueRepository extends EntryRepository implements ProductoptionsValueRepositoryInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry model.
|
* The entry model.
|
||||||
*
|
*
|
||||||
* @var ProductoptionsValueModel
|
* @var ProductoptionsValueModel
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ProductoptionsValueRepository instance.
|
* Create a new ProductoptionsValueRepository instance.
|
||||||
*
|
*
|
||||||
* @param ProductoptionsValueModel $model
|
* @param ProductoptionsValueModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(ProductoptionsValueModel $model)
|
public function __construct(ProductoptionsValueModel $model)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWithOptionsId(array $ids)
|
||||||
|
{
|
||||||
|
return $this->newQuery()->whereIn('product_option_id', $ids)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
|
<?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
|
* Class LookupTableBuilder
|
||||||
*
|
*
|
||||||
@ -9,6 +13,16 @@
|
|||||||
*/
|
*/
|
||||||
class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
|
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 = [
|
protected $filters = [
|
||||||
'product_option'
|
'product_option'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user