Compare commits

...

7 Commits

Author SHA1 Message Date
Mekan1206
82ed332637 WIP 2026-05-03 19:08:02 +05:00
Mekan1206
bac2ad9a3e WIP 2026-05-03 18:42:16 +05:00
Mekan1206
1b467108de WIP 2026-05-03 18:36:49 +05:00
Mekan1206
774ac3c622 remove modal 2026-05-02 16:19:31 +05:00
Mekan1206
62f8deb51f WIP 2026-05-02 16:16:56 +05:00
Mekan1206
40cac31648 fix 2026-05-02 12:56:32 +05:00
Mekan1206
6617c8bd27 WIP 2026-05-02 12:55:20 +05:00
6 changed files with 48 additions and 65 deletions

View File

@@ -6,6 +6,7 @@ use App\Http\Controllers\Api\V1\Filters\Requests\FilterIndexRequest;
use App\Http\Controllers\Controller;
use App\Models\Ecommerce\Channel\Channel;
use App\Models\Ecommerce\Product\Brand\Brand;
use Illuminate\Support\Facades\DB;
use App\Models\Ecommerce\Product\Category\Category;
use App\Models\Ecommerce\Product\Collection\Collection;
use Illuminate\Http\JsonResponse;
@@ -45,7 +46,7 @@ class FilterController extends Controller
}
if ($this->shouldFilterByCollection()) {
return $this->filterByCategoryResource(Collection::find($this->request->collection_id));
return $this->categoriesFor();
}
if ($this->shouldFilterByBrand()) {
@@ -102,11 +103,42 @@ class FilterController extends Controller
->distinct('products.id')
->pluck('products.id');
return Category::where('is_visible', true)->ordered()->join('product_has_relations', 'categories.id', '=', 'product_has_relations.productable_id')
->where('product_has_relations.productable_type', '=', 'category')
->whereIntegerInRaw('product_has_relations.product_id', $products)
->get(['id', 'parent_id', 'name'])
->unique('categories.id');
return Category::where('is_visible', true)
->ordered()
->join('product_has_relations', 'categories.id', '=', 'product_has_relations.productable_id')
->where('product_has_relations.productable_type', '=', 'category')
->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,
]);
}
/**

View File

@@ -14,7 +14,9 @@ class OrderPaymentController extends Controller
public function index(): JsonResponse
{
return response()->rest(
PaymentType::all(['id', 'name'])
PaymentType::query()
->where('is_enabled', true)
->get(['id', 'name', 'is_enabled'])
->map(fn ($paymentType) => [
'id' => $paymentType->id,
'name' => $paymentType->name,

View File

@@ -13,8 +13,6 @@ use App\Models\Ecommerce\Product\Review\Review;
use App\Models\Post\User\UserDoc;
use App\Models\System\Settings\Location\UserAddress;
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\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -25,12 +23,11 @@ use Laravel\Sanctum\HasApiTokens;
use Spatie\DeletedModels\Models\Concerns\KeepsDeletedModels;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable implements BasementUserContract
class User extends Authenticatable
{
use HasApiTokens;
use HasEcommerceChannels;
use HasFactory;
use HasPrivateMessages;
use HasRoles;
use HasSchemalessAttributes;
use InteractsWithNova;

0
artisan Executable file → Normal file
View File

View File

@@ -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"

View File

@@ -101,12 +101,12 @@ Route::get('filters', [FilterController::class, 'index']);
// Global orders...
Route::post('global-order', [GlobalOrderController::class, 'store']);
Route::middleware('auth:sanctum')->group(function () {
Route::get('/chat/contacts', [ChatController::class, 'contacts']);
Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
Route::post('/chat/start', [ChatController::class, 'start']);
Route::post('/chat/send', [ChatController::class, 'send']);
});
// Route::middleware('auth:sanctum')->group(function () {
// Route::get('/chat/contacts', [ChatController::class, 'contacts']);
// Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
// Route::post('/chat/start', [ChatController::class, 'start']);
// Route::post('/chat/send', [ChatController::class, 'send']);
// });
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
// Profile...