Skip to content

Commit

Permalink
Merge branch 'development' of github.com:bakaphp/kanvas-ecosystem-api…
Browse files Browse the repository at this point in the history
… into development
  • Loading branch information
kaioken committed Jun 13, 2024
2 parents a4b27af + 8b2b190 commit e9d5988
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/attributes.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extend type Mutation @guard {
}
extend type Query @guard {
attributes(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/category.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extend type Mutation @guard {

extend type Query @guard {
categories(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/channel.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extend type Mutation @guard {
}
extend type Query @guard {
channels(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/productType.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extend type Mutation @guard {
}
extend type Query {
productTypes(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/status.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extend type Mutation @guard {

extend type Query @guard {
status(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
1 change: 1 addition & 0 deletions graphql/schemas/Inventory/warehouse.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extend type Mutation @guard {
}
extend type Query @guard {
warehouses(
search: String @search
where: _
@whereConditions(
columns: [
Expand Down
32 changes: 32 additions & 0 deletions src/Baka/Traits/DatabaseSearchableTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Baka\Traits;

use Laravel\Scout\EngineManager;
use Laravel\Scout\Engines\Engine;
use Laravel\Scout\Searchable;

trait DatabaseSearchableTrait
{
use Searchable {
search as public traitSearch;
}

/**
* Get the engine used to index the model.
*/
public function searchableUsing(): Engine
{
return app(EngineManager::class)->engine('database');
}

public function toSearchableArray(): array
{
return [
'id' => $this->id,
'name' => $this->name,
];
}
}
2 changes: 2 additions & 0 deletions src/Domains/Inventory/Attributes/Models/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Kanvas\Apps\Models\Apps;
use Kanvas\Companies\Models\Companies;
use Kanvas\Inventory\Models\BaseModel;
use Baka\Traits\DatabaseSearchableTrait;
use Kanvas\Inventory\Variants\Models\VariantsAttributes;

/**
Expand All @@ -27,6 +28,7 @@ class Attributes extends BaseModel
{
use UuidTrait;
use CascadeSoftDeletes;
use DatabaseSearchableTrait;

public $table = 'attributes';
public $guarded = [];
Expand Down
2 changes: 2 additions & 0 deletions src/Domains/Inventory/Categories/Models/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
use Kanvas\Companies\Models\Companies;
use Kanvas\Inventory\Models\BaseModel;
use Kanvas\Inventory\Products\Models\ProductsCategories;
use Baka\Traits\DatabaseSearchableTrait;
use Kanvas\Inventory\Traits\ScopesTrait;

class Categories extends BaseModel
{
use UuidTrait;
use SlugTrait;
use ScopesTrait;
use DatabaseSearchableTrait;

protected $table = 'categories';
protected $guarded = [];
Expand Down
2 changes: 2 additions & 0 deletions src/Domains/Inventory/Channels/Models/Channels.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Kanvas\Apps\Models\Apps;
use Kanvas\Companies\Models\Companies;
use Kanvas\Inventory\Models\BaseModel;
use Baka\Traits\DatabaseSearchableTrait;
use Kanvas\Inventory\Traits\DefaultTrait;
use Kanvas\Inventory\Variants\Models\Variants;
use Kanvas\Inventory\Variants\Models\VariantsChannels;
Expand All @@ -37,6 +38,7 @@ class Channels extends BaseModel
{
use UuidTrait;
use SlugTrait;
use DatabaseSearchableTrait;
use DefaultTrait;

protected $table = 'channels';
Expand Down
2 changes: 2 additions & 0 deletions src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Kanvas\Inventory\Models\BaseModel;
use Kanvas\Inventory\Products\Factories\ProductTypeFactory;
use Kanvas\Inventory\Products\Models\Products;
use Baka\Traits\DatabaseSearchableTrait;
use Kanvas\Inventory\Traits\ScopesTrait;

/**
Expand All @@ -36,6 +37,7 @@ class ProductsTypes extends BaseModel
use UuidTrait;
use SlugTrait;
use ScopesTrait;
use DatabaseSearchableTrait;
use CascadeSoftDeletes;

protected $table = 'products_types';
Expand Down
3 changes: 2 additions & 1 deletion src/Domains/Inventory/Status/Models/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Baka\Traits\SlugTrait;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Kanvas\Inventory\Models\BaseModel;
use Baka\Traits\DatabaseSearchableTrait;
use Kanvas\Inventory\Traits\DefaultTrait;
use Kanvas\Inventory\Variants\Models\Variants;
use Kanvas\Inventory\Variants\Models\VariantsWarehouses;
Expand All @@ -24,7 +25,7 @@
class Status extends BaseModel
{
use SlugTrait;
//use Searchable;
use DatabaseSearchableTrait;
use DefaultTrait;

protected $table = 'status';
Expand Down
2 changes: 2 additions & 0 deletions src/Domains/Inventory/Warehouses/Models/Warehouses.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Kanvas\Inventory\Warehouses\Models;

use Baka\Traits\DatabaseSearchableTrait;
use Baka\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
Expand Down Expand Up @@ -35,6 +36,7 @@ class Warehouses extends BaseModel
{
use UuidTrait;
use DefaultTrait;
use DatabaseSearchableTrait;

protected $table = 'warehouses';

Expand Down

0 comments on commit e9d5988

Please sign in to comment.