Compare commits
7 Commits
005b428cf1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82ed332637 | ||
|
|
bac2ad9a3e | ||
|
|
1b467108de | ||
|
|
774ac3c622 | ||
|
|
62f8deb51f | ||
|
|
40cac31648 | ||
|
|
6617c8bd27 |
@@ -6,6 +6,7 @@ use App\Http\Controllers\Api\V1\Filters\Requests\FilterIndexRequest;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Ecommerce\Channel\Channel;
|
use App\Models\Ecommerce\Channel\Channel;
|
||||||
use App\Models\Ecommerce\Product\Brand\Brand;
|
use App\Models\Ecommerce\Product\Brand\Brand;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use App\Models\Ecommerce\Product\Category\Category;
|
use App\Models\Ecommerce\Product\Category\Category;
|
||||||
use App\Models\Ecommerce\Product\Collection\Collection;
|
use App\Models\Ecommerce\Product\Collection\Collection;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
@@ -45,7 +46,7 @@ class FilterController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldFilterByCollection()) {
|
if ($this->shouldFilterByCollection()) {
|
||||||
return $this->filterByCategoryResource(Collection::find($this->request->collection_id));
|
return $this->categoriesFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldFilterByBrand()) {
|
if ($this->shouldFilterByBrand()) {
|
||||||
@@ -102,11 +103,42 @@ class FilterController extends Controller
|
|||||||
->distinct('products.id')
|
->distinct('products.id')
|
||||||
->pluck('products.id');
|
->pluck('products.id');
|
||||||
|
|
||||||
return Category::where('is_visible', true)->ordered()->join('product_has_relations', 'categories.id', '=', 'product_has_relations.productable_id')
|
return Category::where('is_visible', true)
|
||||||
->where('product_has_relations.productable_type', '=', 'category')
|
->ordered()
|
||||||
->whereIntegerInRaw('product_has_relations.product_id', $products)
|
->join('product_has_relations', 'categories.id', '=', 'product_has_relations.productable_id')
|
||||||
->get(['id', 'parent_id', 'name'])
|
->where('product_has_relations.productable_type', '=', 'category')
|
||||||
->unique('categories.id');
|
->whereIntegerInRaw('product_has_relations.product_id', $products)
|
||||||
|
->get(['categories.id', 'categories.parent_id', 'categories.name'])
|
||||||
|
->unique('categories.id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories for a resource
|
||||||
|
*/
|
||||||
|
private function categoriesFor($resource)
|
||||||
|
{
|
||||||
|
return DB::table('categories as c')
|
||||||
|
->select('c.id', 'c.parent_id', 'c.name')
|
||||||
|
->where('c.is_visible', true)
|
||||||
|
->whereExists(function ($query) {
|
||||||
|
$query->select(DB::raw(1))
|
||||||
|
->from('product_has_relations as phr_cat')
|
||||||
|
->join('products as p', 'p.id', '=', 'phr_cat.product_id')
|
||||||
|
->join('product_has_relations as phr_chan', 'phr_chan.product_id', '=', 'p.id')
|
||||||
|
->whereColumn('phr_cat.productable_id', 'c.id')
|
||||||
|
->where('phr_cat.productable_type', 'category')
|
||||||
|
->where('phr_chan.productable_type', 'channel')
|
||||||
|
->where('phr_chan.productable_id', 6)
|
||||||
|
->where('p.is_visible', true)
|
||||||
|
->whereNull('p.parent_id')
|
||||||
|
->where('p.stock', '>', 0);
|
||||||
|
})
|
||||||
|
->get()
|
||||||
|
->map(fn ($category) => [
|
||||||
|
'id' => $category->id,
|
||||||
|
'parent_id' => $category->parent_id,
|
||||||
|
'name' => $category->name,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ class OrderPaymentController extends Controller
|
|||||||
public function index(): JsonResponse
|
public function index(): JsonResponse
|
||||||
{
|
{
|
||||||
return response()->rest(
|
return response()->rest(
|
||||||
PaymentType::all(['id', 'name'])
|
PaymentType::query()
|
||||||
|
->where('is_enabled', true)
|
||||||
|
->get(['id', 'name', 'is_enabled'])
|
||||||
->map(fn ($paymentType) => [
|
->map(fn ($paymentType) => [
|
||||||
'id' => $paymentType->id,
|
'id' => $paymentType->id,
|
||||||
'name' => $paymentType->name,
|
'name' => $paymentType->name,
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ use App\Models\Ecommerce\Product\Review\Review;
|
|||||||
use App\Models\Post\User\UserDoc;
|
use App\Models\Post\User\UserDoc;
|
||||||
use App\Models\System\Settings\Location\UserAddress;
|
use App\Models\System\Settings\Location\UserAddress;
|
||||||
use App\Repositories\System\Cache\CacheRepository;
|
use App\Repositories\System\Cache\CacheRepository;
|
||||||
use BasementChat\Basement\Contracts\User as BasementUserContract;
|
|
||||||
use BasementChat\Basement\Traits\HasPrivateMessages;
|
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@@ -25,12 +23,11 @@ use Laravel\Sanctum\HasApiTokens;
|
|||||||
use Spatie\DeletedModels\Models\Concerns\KeepsDeletedModels;
|
use Spatie\DeletedModels\Models\Concerns\KeepsDeletedModels;
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
class User extends Authenticatable implements BasementUserContract
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use HasApiTokens;
|
use HasApiTokens;
|
||||||
use HasEcommerceChannels;
|
use HasEcommerceChannels;
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HasPrivateMessages;
|
|
||||||
use HasRoles;
|
use HasRoles;
|
||||||
use HasSchemalessAttributes;
|
use HasSchemalessAttributes;
|
||||||
use InteractsWithNova;
|
use InteractsWithNova;
|
||||||
|
|||||||
48
modal.md
48
modal.md
@@ -1,48 +0,0 @@
|
|||||||
```html
|
|
||||||
<component
|
|
||||||
v-for="(rowField, j) in this.field.fields"
|
|
||||||
:key="j"
|
|
||||||
:is="`form-${rowField.component}`"
|
|
||||||
:field="rowField"
|
|
||||||
class="w-full"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Modal
|
|
||||||
:show="showModal"
|
|
||||||
size="7xl"
|
|
||||||
tabindex="-1"
|
|
||||||
role="dialog"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<ModalHeader v-text="'Headline of Modal'" class="bg-gray-100 dark:bg-gray-700" />
|
|
||||||
|
|
||||||
<ModalBody>
|
|
||||||
<div class="px-4 py-5 sm:p-6">
|
|
||||||
<ModalForm></ModalForm>
|
|
||||||
</div>
|
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter>
|
|
||||||
<div class="flex items-center ml-auto">
|
|
||||||
<CancelButton
|
|
||||||
component="button"
|
|
||||||
type="button"
|
|
||||||
dusk="cancel-action-button"
|
|
||||||
class="ml-auto mr-3"
|
|
||||||
@click="onClose"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DefaultButton
|
|
||||||
type="submit"
|
|
||||||
@click="onSubmit"
|
|
||||||
>
|
|
||||||
Submit
|
|
||||||
</DefaultButton>
|
|
||||||
</div>
|
|
||||||
</ModalFooter>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
```
|
|
||||||
|
|
||||||
"type": "composer",
|
|
||||||
"url": "https://nova.laravel.com"
|
|
||||||
@@ -101,12 +101,12 @@ Route::get('filters', [FilterController::class, 'index']);
|
|||||||
// Global orders...
|
// Global orders...
|
||||||
Route::post('global-order', [GlobalOrderController::class, 'store']);
|
Route::post('global-order', [GlobalOrderController::class, 'store']);
|
||||||
|
|
||||||
Route::middleware('auth:sanctum')->group(function () {
|
// Route::middleware('auth:sanctum')->group(function () {
|
||||||
Route::get('/chat/contacts', [ChatController::class, 'contacts']);
|
// Route::get('/chat/contacts', [ChatController::class, 'contacts']);
|
||||||
Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
|
// Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
|
||||||
Route::post('/chat/start', [ChatController::class, 'start']);
|
// Route::post('/chat/start', [ChatController::class, 'start']);
|
||||||
Route::post('/chat/send', [ChatController::class, 'send']);
|
// Route::post('/chat/send', [ChatController::class, 'send']);
|
||||||
});
|
// });
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
|
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
|
||||||
// Profile...
|
// Profile...
|
||||||
|
|||||||
Reference in New Issue
Block a user