Compare commits
3 Commits
005b428cf1
...
62f8deb51f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f8deb51f | ||
|
|
40cac31648 | ||
|
|
6617c8bd27 |
@@ -62,29 +62,29 @@ class FilterController extends Controller
|
||||
private function brands()
|
||||
{
|
||||
if ($this->shouldFilterByBrand()) {
|
||||
return Brand::where('id', $this->request->brand_id)->get(['id', 'name']);
|
||||
return Brand::query()->where('id', $this->request->brand_id)->get(['id', 'name']);
|
||||
}
|
||||
|
||||
if ($this->shouldFilterByCategory()) {
|
||||
$brands = Category::find($this->request->category_id)->products()
|
||||
$brands = Category::query()->find($this->request->category_id)->products()
|
||||
->where('products.is_visible', true)
|
||||
->where('products.parent_id', null)
|
||||
->where('products.stock', '>', 0)
|
||||
->distinct('products.brand_id')
|
||||
->pluck('products.brand_id');
|
||||
|
||||
return Brand::whereIntegerInRaw('id', $brands)->get(['id', 'name']);
|
||||
return Brand::query()->whereIntegerInRaw('id', $brands)->get(['id', 'name']);
|
||||
}
|
||||
|
||||
if ($this->shouldFilterByCollection()) {
|
||||
$brands = Collection::find($this->request->collection_id)->products()
|
||||
$brands = Collection::query()->find($this->request->collection_id)->products()
|
||||
->where('products.is_visible', true)
|
||||
->where('products.parent_id', null)
|
||||
->where('products.stock', '>', 0)
|
||||
->distinct('products.brand_id')
|
||||
->pluck('products.brand_id');
|
||||
|
||||
return Brand::whereIntegerInRaw('id', $brands)->get(['id', 'name']);
|
||||
return Brand::query()->whereIntegerInRaw('id', $brands)->get(['id', 'name']);
|
||||
}
|
||||
|
||||
return Brand::query()->where('is_visible', true)->ordered()->get(['id', 'name']);
|
||||
@@ -102,11 +102,18 @@ 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')
|
||||
return Category::query()
|
||||
->distinct('categories.id')
|
||||
->where('is_visible', true)
|
||||
->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');
|
||||
->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
|
||||
{
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user