mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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 $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,
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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',
|
||||
],
|
||||
];
|
||||
|
||||
@ -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',
|
||||
],
|
||||
];
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||
|
||||
interface ProductoptionRepositoryInterface extends EntryRepositoryInterface
|
||||
{
|
||||
|
||||
public function getWithCategoryId($id);
|
||||
}
|
||||
|
||||
@ -22,4 +22,9 @@ class ProductoptionRepository extends EntryRepository implements ProductoptionRe
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function getWithCategoryId($id)
|
||||
{
|
||||
return $this->findAllBy('category',$id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
*
|
||||
|
||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\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
|
||||
{
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user