Compare commits
56 Commits
f5de6b0a58
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6093a45761 | ||
|
|
7f0b92a7ff | ||
|
|
715acc4e97 | ||
|
|
859e4ebbe8 | ||
|
|
24b85763e5 | ||
|
|
a6cf6410b2 | ||
|
|
8c4e214e7b | ||
|
|
e227b24de5 | ||
|
|
79b10b20ea | ||
|
|
fa9d9b68b5 | ||
|
|
c23d0eeab0 | ||
|
|
14b47d40e8 | ||
|
|
f365bff782 | ||
|
|
82ed332637 | ||
|
|
bac2ad9a3e | ||
|
|
1b467108de | ||
|
|
774ac3c622 | ||
|
|
62f8deb51f | ||
|
|
40cac31648 | ||
|
|
6617c8bd27 | ||
|
|
005b428cf1 | ||
|
|
f772562376 | ||
|
|
a07c764dfe | ||
|
|
6dc6802445 | ||
|
|
7cc0c0e0a6 | ||
|
|
bc2770c24d | ||
|
|
dd633ef7da | ||
|
|
9b95087b94 | ||
| b9ce4cc5d5 | |||
| 78b9e6ee0b | |||
| 1f9942f08a | |||
| 0fe90e6b0e | |||
| 7eefafa805 | |||
| fdc4c2a1a5 | |||
| 72432d36e7 | |||
|
|
34ad7c43e9 | ||
|
|
d728a3af83 | ||
|
|
f477142f11 | ||
|
|
9f27fe260e | ||
|
|
ba9402afb0 | ||
| 19cc47942b | |||
| aef0e38be9 | |||
| 637951b5ab | |||
| 125d619935 | |||
| 8c38dd846f | |||
| 6f5eb0d776 | |||
| 1cdabc9b8f | |||
| 7259cf7a05 | |||
| d957b07231 | |||
| b06755adcf | |||
| 9a9afc9218 | |||
| df70431042 | |||
| d46b03abef | |||
| d9aae9fa1a | |||
| a9df04edc5 | |||
| b6bfcfcdd8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@
|
|||||||
/public/build
|
/public/build
|
||||||
/public/hot
|
/public/hot
|
||||||
/public/storage
|
/public/storage
|
||||||
|
/public/favicons/
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
/vendor
|
/vendor
|
||||||
.env
|
.env
|
||||||
|
|||||||
37
app/Events/Conversation/MessageSent.php
Normal file
37
app/Events/Conversation/MessageSent.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Events\Conversation;
|
||||||
|
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class MessageSent implements ShouldBroadcast
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
public $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*/
|
||||||
|
public function __construct($message)
|
||||||
|
{
|
||||||
|
$this->message = $message->load('user');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the channels the event should broadcast on.
|
||||||
|
*
|
||||||
|
* @return array<int, Channel>
|
||||||
|
*/
|
||||||
|
public function broadcastOn(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new PrivateChannel('chat.'.$this->message->conversation_id),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace App\Exports\Ecommerce\Product\Order;
|
|||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\OrderItem;
|
use App\Models\Ecommerce\Product\Order\OrderItem;
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Maatwebsite\Excel\Concerns\Exportable;
|
use Maatwebsite\Excel\Concerns\Exportable;
|
||||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
@@ -23,7 +24,7 @@ class ExportOrderReport implements FromQuery, ShouldAutoSize, WithHeadings, With
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function query()
|
public function query()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,13 +41,14 @@ class ProductFilterer
|
|||||||
public function validateRequest(): \Illuminate\Contracts\Validation\Validator
|
public function validateRequest(): \Illuminate\Contracts\Validation\Validator
|
||||||
{
|
{
|
||||||
return Validator::make($this->request->all(), [
|
return Validator::make($this->request->all(), [
|
||||||
'ids' => ['nullable', 'string', new CommaSeparatedIntegers()],
|
'ids' => ['nullable', 'string', new CommaSeparatedIntegers],
|
||||||
'brands' => ['nullable', 'string', new CommaSeparatedIntegers()],
|
'brands' => ['nullable', 'string', new CommaSeparatedIntegers],
|
||||||
'categories' => ['nullable', 'string', new CommaSeparatedIntegers()],
|
'categories' => ['nullable', 'string', new CommaSeparatedIntegers],
|
||||||
'name' => ['nullable', 'string', 'max:255'],
|
'name' => ['nullable', 'string', 'max:255'],
|
||||||
'min_price' => ['nullable', 'numeric'],
|
'min_price' => ['nullable', 'numeric'],
|
||||||
'max_price' => ['nullable', 'numeric'],
|
'max_price' => ['nullable', 'numeric'],
|
||||||
'backorder' => ['nullable', 'in:0,1'],
|
'backorder' => ['nullable', 'in:0,1'],
|
||||||
|
'properties' => ['nullable', 'array'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +94,18 @@ class ProductFilterer
|
|||||||
$this->queryBuilder->where('products.backorder', $this->request->backorder);
|
$this->queryBuilder->where('products.backorder', $this->request->backorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->request->filled('properties')) {
|
||||||
|
foreach ($this->request->input('properties') as $attributeSlug => $values) {
|
||||||
|
$valuesArray = explode(',', $values);
|
||||||
|
|
||||||
|
$this->queryBuilder->where(function ($query) use ($attributeSlug, $valuesArray) {
|
||||||
|
foreach ($valuesArray as $value) {
|
||||||
|
$query->orWhereJsonContains("properties_json->{$attributeSlug}", $value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->queryBuilder;
|
return $this->queryBuilder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
use App\Models\Auth\Verification;
|
use App\Models\Auth\Verification;
|
||||||
use App\Models\Ecommerce\Channel\Channel;
|
use App\Models\Ecommerce\Channel\Channel;
|
||||||
use App\Models\Ecommerce\Product\Inventory\Inventory;
|
use App\Models\Ecommerce\Product\Inventory\Inventory;
|
||||||
use App\Models\System\Settings\Settings;
|
|
||||||
use App\Repositories\Ecommerce\Product\Barcode\BarcodeRepository;
|
use App\Repositories\Ecommerce\Product\Barcode\BarcodeRepository;
|
||||||
use Illuminate\Http\Client\PendingRequest;
|
use Illuminate\Http\Client\PendingRequest;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -33,6 +32,20 @@ if (! function_exists('translatable')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate
|
||||||
|
*/
|
||||||
|
function tr(string $text, string $locale = 'tk'): string
|
||||||
|
{
|
||||||
|
$text = json_decode($text);
|
||||||
|
|
||||||
|
if ($text) {
|
||||||
|
return $text->{$locale} ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (! function_exists('removeWhiteSpace')) {
|
if (! function_exists('removeWhiteSpace')) {
|
||||||
/**
|
/**
|
||||||
* Remove white sapce from string
|
* Remove white sapce from string
|
||||||
@@ -71,18 +84,18 @@ if (! function_exists('sendSMS')) {
|
|||||||
function sendSMS(string|int $phone, string|int $message): mixed
|
function sendSMS(string|int $phone, string|int $message): mixed
|
||||||
{
|
{
|
||||||
$response = Http::retry(
|
$response = Http::retry(
|
||||||
times: 3,
|
times: 3,
|
||||||
sleepMilliseconds: 50,
|
sleepMilliseconds: 50,
|
||||||
throw: false,
|
throw: false,
|
||||||
when: function (Exception $exception, PendingRequest $request) {
|
when: function (Exception $exception, PendingRequest $request) {
|
||||||
Log::channel('sms_api_error')
|
Log::channel('sms_api_error')
|
||||||
->error('Exception: ', [
|
->error('Exception: ', [
|
||||||
'message' => $exception->getMessage(),
|
'message' => $exception->getMessage(),
|
||||||
'line' => $exception->getLine(),
|
'line' => $exception->getLine(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
->post('http://216.250.14.144:3000/api/data', [
|
->post('http://216.250.14.144:3000/api/data', [
|
||||||
'phone' => '+993'.$phone,
|
'phone' => '+993'.$phone,
|
||||||
'code' => $message,
|
'code' => $message,
|
||||||
@@ -96,7 +109,7 @@ if (! function_exists('sendSMSVerification')) {
|
|||||||
/**
|
/**
|
||||||
* Send a sms verification code
|
* Send a sms verification code
|
||||||
*
|
*
|
||||||
* @return \App\Models\Verification | null
|
* @return App\Models\Verification | null
|
||||||
*/
|
*/
|
||||||
function sendSMSVerification(string|int $phone_number): ?Verification
|
function sendSMSVerification(string|int $phone_number): ?Verification
|
||||||
{
|
{
|
||||||
@@ -168,7 +181,7 @@ if (! function_exists('tmpostChannel')) {
|
|||||||
/**
|
/**
|
||||||
* Default channel
|
* Default channel
|
||||||
*
|
*
|
||||||
* @return \App\Models\Shop\Channel
|
* @return App\Models\Shop\Channel
|
||||||
*/
|
*/
|
||||||
function tmpostChannel(): Channel
|
function tmpostChannel(): Channel
|
||||||
{
|
{
|
||||||
@@ -324,7 +337,7 @@ if (! function_exists('orderAdminNumber')) {
|
|||||||
*/
|
*/
|
||||||
function orderAdminNumber(): int
|
function orderAdminNumber(): int
|
||||||
{
|
{
|
||||||
return 65728952;
|
return 61126667;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +368,7 @@ if (! function_exists('calculateProductPriceAmount')) {
|
|||||||
*/
|
*/
|
||||||
function halkbankCredentials(string $key = ''): int|string|array
|
function halkbankCredentials(string $key = ''): int|string|array
|
||||||
{
|
{
|
||||||
return match($key) {
|
return match ($key) {
|
||||||
'username' => 516122500260,
|
'username' => 516122500260,
|
||||||
'password' => 'MrZsO9wfgWOBjf4',
|
'password' => 'MrZsO9wfgWOBjf4',
|
||||||
default => [
|
default => [
|
||||||
@@ -368,7 +381,7 @@ function halkbankCredentials(string $key = ''): int|string|array
|
|||||||
/**
|
/**
|
||||||
* Create halkbank order
|
* Create halkbank order
|
||||||
*
|
*
|
||||||
* @param string $price
|
* @param string $price
|
||||||
* @return array{status: string, url: string|null}
|
* @return array{status: string, url: string|null}
|
||||||
*/
|
*/
|
||||||
function createHalkbankOrder($price = 123): array
|
function createHalkbankOrder($price = 123): array
|
||||||
@@ -397,11 +410,23 @@ function createHalkbankOrder($price = 123): array
|
|||||||
return [
|
return [
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
|
'orderId' => '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'url' => $paymentResponse['formUrl'],
|
'url' => $paymentResponse['formUrl'],
|
||||||
|
'orderId' => $paymentResponse['orderId'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Original quality :D
|
||||||
|
*/
|
||||||
|
function convertToOriginalFormat(int|float|string $apiPrice): string
|
||||||
|
{
|
||||||
|
$originalPrice = intval($apiPrice) / 100;
|
||||||
|
|
||||||
|
return number_format($originalPrice, 2, '.', '');
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ namespace App\Http\Controllers\Api\V1;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Shop\Product\Attribute;
|
use App\Models\Shop\Product\Attribute;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class AttributeController extends Controller
|
class AttributeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Auth\Register;
|
namespace App\Http\Controllers\Api\V1\Auth\Register;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class AuthRegisterRequest extends FormRequest
|
class AuthRegisterRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class AuthRegisterRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\V1\Banner\Requests;
|
|||||||
|
|
||||||
use App\Models\CMS\Media\Banner;
|
use App\Models\CMS\Media\Banner;
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ class BannerIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Brand\Resources;
|
namespace App\Http\Controllers\Api\V1\Brand\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class BrandResource extends JsonResource
|
class BrandResource extends JsonResource
|
||||||
@@ -9,8 +11,8 @@ class BrandResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\V1\Carousel\Requests;
|
|||||||
|
|
||||||
use App\Models\CMS\Media\Carousel;
|
use App\Models\CMS\Media\Carousel;
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ class CarouselIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CartController extends Controller
|
|||||||
public function index(): JsonResponse
|
public function index(): JsonResponse
|
||||||
{
|
{
|
||||||
$cartItems = auth()->user()->carts()
|
$cartItems = auth()->user()->carts()
|
||||||
->with(['product' => ['media', 'brand']])
|
->with(['product' => ['media', 'brand', 'channels']])
|
||||||
->orderBy('cart_items.id', 'desc')
|
->orderBy('cart_items.id', 'desc')
|
||||||
->get()
|
->get()
|
||||||
->each(function ($cartItem) {
|
->each(function ($cartItem) {
|
||||||
@@ -31,16 +31,26 @@ class CartController extends Controller
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$data = $cartItems->map(fn ($cartItem) => [
|
||||||
|
'id' => $cartItem->id,
|
||||||
|
'user_id' => $cartItem->user_id,
|
||||||
|
'product_id' => $cartItem->product_id,
|
||||||
|
'product_quantity' => $cartItem->product_quantity,
|
||||||
|
'created_at' => $cartItem->created_at,
|
||||||
|
'updated_at' => $cartItem->updated_at,
|
||||||
|
'product' => new ProductResource($cartItem->product),
|
||||||
|
])->groupBy(function (array $cartItem) {
|
||||||
|
if (isset($cartItem['product']) && $cartItem['product']->channels->count() > 0) {
|
||||||
|
return $cartItem['product']->channels[0]->slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'default';
|
||||||
|
});
|
||||||
|
|
||||||
return response()->rest(
|
return response()->rest(
|
||||||
$cartItems->map(fn ($cartItem) => [
|
$data,
|
||||||
'id' => $cartItem->id,
|
code: 200,
|
||||||
'user_id' => $cartItem->user_id,
|
message: 'Cart items'
|
||||||
'product_id' => $cartItem->product_id,
|
|
||||||
'product_quantity' => $cartItem->product_quantity,
|
|
||||||
'created_at' => $cartItem->created_at,
|
|
||||||
'updated_at' => $cartItem->updated_at,
|
|
||||||
'product' => new ProductResource($cartItem->product),
|
|
||||||
])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ class CategoryController extends Controller
|
|||||||
return response()->rest_paginate(
|
return response()->rest_paginate(
|
||||||
ProductResource::collection(
|
ProductResource::collection(
|
||||||
ProductRepository::make($request)
|
ProductRepository::make($request)
|
||||||
->queryAsFromResource($category)
|
// ->queryAsFromResource($category)
|
||||||
|
->applyMultiLevelFilter($category)
|
||||||
->applyBasicQueries()
|
->applyBasicQueries()
|
||||||
->applyFilters()
|
->applyFilters()
|
||||||
->applySorting()
|
->applySorting()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Category\Resources;
|
namespace App\Http\Controllers\Api\V1\Category\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class CategoryResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray(Request $request): array
|
public function toArray(Request $request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Api\V1\Channel\Requests;
|
namespace App\Http\Controllers\Api\V1\Channel\Requests;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Channel\Channel;
|
use App\Models\Ecommerce\Channel\Channel;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ChannelIndexRequest extends FormRequest
|
class ChannelIndexRequest extends FormRequest
|
||||||
@@ -10,7 +11,7 @@ class ChannelIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class CollectionController extends Controller
|
|||||||
{
|
{
|
||||||
return response()->rest(
|
return response()->rest(
|
||||||
CollectionResource::collection(
|
CollectionResource::collection(
|
||||||
Collection::with('media')->where('is_visible', true)->ordered()->get()
|
Collection::query()->with('media')->where('is_visible', true)->inRandomOrder()->get()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class CollectionController extends Controller
|
|||||||
|
|
||||||
return response()->rest_paginate(
|
return response()->rest_paginate(
|
||||||
CollectionResource::collection(
|
CollectionResource::collection(
|
||||||
Collection::with('media')->where('is_visible', true)->ordered()->simplePaginate($perPage)
|
Collection::query()->with('media')->where('is_visible', true)->inRandomOrder()->simplePaginate($perPage)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Http\Controllers\Api\V1\Collection\Resources;
|
namespace App\Http\Controllers\Api\V1\Collection\Resources;
|
||||||
|
|
||||||
use App\Http\Resources\MediaResource;
|
use App\Http\Resources\MediaResource;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class CollectionResource extends JsonResource
|
class CollectionResource extends JsonResource
|
||||||
@@ -10,8 +12,8 @@ class CollectionResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api\V1;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Shop\Product\Product;
|
use App\Models\Shop\Product\Product;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ class CommentController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ class CommentController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
@@ -50,7 +51,7 @@ class CommentController extends Controller
|
|||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
@@ -61,7 +62,7 @@ class CommentController extends Controller
|
|||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request)
|
public function update(Request $request)
|
||||||
{
|
{
|
||||||
@@ -85,7 +86,7 @@ class CommentController extends Controller
|
|||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request)
|
public function destroy(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class VendorProductStoreRequest extends FormRequest
|
class VendorProductStoreRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class VendorProductStoreRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class VendorProductUpdateRequest extends FormRequest
|
class VendorProductUpdateRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class VendorProductUpdateRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Models\Ecommerce\Product\Product\Product;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Repositories\Ecommerce\Product\ProductRepository;
|
use App\Repositories\Ecommerce\Product\ProductRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class VendorProductController extends Controller
|
class VendorProductController extends Controller
|
||||||
@@ -18,7 +19,7 @@ class VendorProductController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ class VendorProductController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function store(VendorProductStoreRequest $request)
|
public function store(VendorProductStoreRequest $request)
|
||||||
{
|
{
|
||||||
@@ -105,7 +106,7 @@ class VendorProductController extends Controller
|
|||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param App\Models\Ecommerce\Product\Product\Product $product
|
* @param App\Models\Ecommerce\Product\Product\Product $product
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show(Product $product)
|
public function show(Product $product)
|
||||||
{
|
{
|
||||||
@@ -118,7 +119,7 @@ class VendorProductController extends Controller
|
|||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function update(VendorProductUpdateRequest $request, Product $product)
|
public function update(VendorProductUpdateRequest $request, Product $product)
|
||||||
{
|
{
|
||||||
@@ -188,7 +189,7 @@ class VendorProductController extends Controller
|
|||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function destroy(Product $product)
|
public function destroy(Product $product)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Resources\Order;
|
namespace App\Http\Controllers\Api\V1\Entrepreneur\Resources\Order;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -19,7 +18,7 @@ class OrderIndexResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => OrderStatus::formattedStatusFor($this->status),
|
'status' => OrderStatus::formattedStatusFor($this->status),
|
||||||
'shipping_method' => OrderShipping::formattedShippingMethod($this->shipping_method),
|
'shipping_method' => $this->formattedShippingMethod(),
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
'delivery_time' => $this->delivery_time,
|
'delivery_time' => $this->delivery_time,
|
||||||
'delivery_at' => $this->delivery_at,
|
'delivery_at' => $this->delivery_at,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Resources\Order;
|
namespace App\Http\Controllers\Api\V1\Entrepreneur\Resources\Order;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -19,7 +18,7 @@ class OrderShowResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => OrderStatus::formattedStatusFor($this->status),
|
'status' => OrderStatus::formattedStatusFor($this->status),
|
||||||
'shipping_method' => OrderShipping::formattedShippingMethod($this->shipping_method),
|
'shipping_method' => $this->formattedShippingMethod(),
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
'delivery_time' => $this->delivery_time,
|
'delivery_time' => $this->delivery_time,
|
||||||
'delivery_at' => $this->delivery_at,
|
'delivery_at' => $this->delivery_at,
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Http\Controllers\Api\V1\Favorite\Resources;
|
namespace App\Http\Controllers\Api\V1\Favorite\Resources;
|
||||||
|
|
||||||
use App\Http\Controllers\Api\V1\Product\Resources\ProductResource;
|
use App\Http\Controllers\Api\V1\Product\Resources\ProductResource;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class FavoriteResource extends JsonResource
|
class FavoriteResource extends JsonResource
|
||||||
@@ -10,8 +12,8 @@ class FavoriteResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ namespace App\Http\Controllers\Api\V1\Filters;
|
|||||||
|
|
||||||
use App\Http\Controllers\Api\V1\Filters\Requests\FilterIndexRequest;
|
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\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;
|
||||||
@@ -25,11 +27,7 @@ class FilterController extends Controller
|
|||||||
public function index(FilterIndexRequest $request): JsonResponse
|
public function index(FilterIndexRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
return response()->rest([
|
return response()->rest([
|
||||||
'categories' => $this->categories()->map(fn ($category) => [
|
'categories' => $this->categories(),
|
||||||
'id' => $category->id,
|
|
||||||
'parent_id' => $category->parent_id,
|
|
||||||
'name' => $category->name,
|
|
||||||
]),
|
|
||||||
'brands' => $this->brands(),
|
'brands' => $this->brands(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -40,15 +38,29 @@ class FilterController extends Controller
|
|||||||
private function categories()
|
private function categories()
|
||||||
{
|
{
|
||||||
if ($this->shouldFilterByCategory()) {
|
if ($this->shouldFilterByCategory()) {
|
||||||
return Category::find($this->request->category_id, ['id', 'parent_id'])->children()->get(['id', 'parent_id', 'name']);
|
return Category::query()
|
||||||
|
->find($this->request->category_id, ['id', 'parent_id'])
|
||||||
|
->children()
|
||||||
|
->where('is_visible', true)
|
||||||
|
->ordered()
|
||||||
|
->get(['id', 'parent_id', 'name'])
|
||||||
|
->map(fn ($category) => [
|
||||||
|
'id' => $category->id,
|
||||||
|
'parent_id' => $category->parent_id,
|
||||||
|
'name' => $category->name,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldFilterByCollection()) {
|
if ($this->shouldFilterByCollection()) {
|
||||||
return $this->filterByCategoryResource(Collection::find($this->request->collection_id));
|
return $this->categoriesFor($this->request->collection_id, 'collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldFilterByBrand()) {
|
if ($this->shouldFilterByBrand()) {
|
||||||
return $this->filterByCategoryResource(Brand::find($this->request->brand_id));
|
return $this->categoriesForBrand($this->request->brand_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->shouldFilterByChannel()) {
|
||||||
|
return $this->categoriesFor($this->request->channel_id, 'channel');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Category::query()->where('is_visible', true)->ordered()->get(['id', 'parent_id', 'name']);
|
return Category::query()->where('is_visible', true)->ordered()->get(['id', 'parent_id', 'name']);
|
||||||
@@ -57,51 +69,116 @@ class FilterController extends Controller
|
|||||||
private function brands()
|
private function brands()
|
||||||
{
|
{
|
||||||
if ($this->shouldFilterByBrand()) {
|
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()) {
|
if ($this->shouldFilterByCategory()) {
|
||||||
$brands = Category::find($this->request->category_id)->products()
|
$categoryId = (int) $this->request->category_id;
|
||||||
->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 DB::table('brands')
|
||||||
|
->select('brands.id', 'brands.name')
|
||||||
|
->join('products', 'products.brand_id', '=', 'brands.id')
|
||||||
|
->join('product_has_relations', 'products.id', '=', 'product_has_relations.product_id')
|
||||||
|
->where('product_has_relations.productable_type', 'category')
|
||||||
|
->where('product_has_relations.productable_id', $categoryId)
|
||||||
|
->where('products.is_visible', true)
|
||||||
|
->whereNull('products.parent_id')
|
||||||
|
->where('products.stock', '>', 0)
|
||||||
|
->groupBy('brands.id', 'brands.name', 'brands.sort_order')
|
||||||
|
->orderBy('brands.sort_order')
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldFilterByCollection()) {
|
if ($this->shouldFilterByCollection()) {
|
||||||
$brands = Collection::find($this->request->collection_id)->products()
|
$collectionId = (int) $this->request->collection_id;
|
||||||
->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 DB::table('brands')
|
||||||
|
->select('brands.id', 'brands.name')
|
||||||
|
->join('products', 'products.brand_id', '=', 'brands.id')
|
||||||
|
->join('product_has_relations', 'products.id', '=', 'product_has_relations.product_id')
|
||||||
|
->where('product_has_relations.productable_type', 'collection')
|
||||||
|
->where('product_has_relations.productable_id', $collectionId)
|
||||||
|
->where('products.is_visible', true)
|
||||||
|
->whereNull('products.parent_id')
|
||||||
|
->where('products.stock', '>', 0)
|
||||||
|
->groupBy('brands.id', 'brands.name', 'brands.sort_order')
|
||||||
|
->orderBy('brands.sort_order')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->shouldFilterByChannel()) {
|
||||||
|
$channelId = (int) $this->request->channel_id;
|
||||||
|
|
||||||
|
return DB::table('brands')
|
||||||
|
->select('brands.id', 'brands.name')
|
||||||
|
->join('products', 'products.brand_id', '=', 'brands.id')
|
||||||
|
->join('product_has_relations', 'products.id', '=', 'product_has_relations.product_id')
|
||||||
|
->where('product_has_relations.productable_type', 'channel')
|
||||||
|
->where('product_has_relations.productable_id', $channelId)
|
||||||
|
->where('products.is_visible', true)
|
||||||
|
->whereNull('products.parent_id')
|
||||||
|
->where('products.stock', '>', 0)
|
||||||
|
->groupBy('brands.id', 'brands.name', 'brands.sort_order')
|
||||||
|
->orderBy('brands.sort_order')
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Brand::query()->where('is_visible', true)->ordered()->get(['id', 'name']);
|
return Brand::query()->where('is_visible', true)->ordered()->get(['id', 'name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter by category
|
* Categories for a resource
|
||||||
*/
|
*/
|
||||||
private function filterByCategoryResource($resource)
|
private function categoriesFor(int $id, string $type)
|
||||||
{
|
{
|
||||||
$products = $resource->products()
|
return DB::table('categories as c')
|
||||||
->where('products.is_visible', true)
|
->select('c.id', 'c.parent_id', 'c.name')
|
||||||
->where('products.parent_id', null)
|
->where('c.is_visible', true)
|
||||||
->where('products.stock', '>', 0)
|
->whereExists(function ($query) use ($id, $type) {
|
||||||
->distinct('products.id')
|
$query->select(DB::raw(1))
|
||||||
->pluck('products.id');
|
->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', $type)
|
||||||
|
->where('phr_chan.productable_id', $id)
|
||||||
|
->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' => tr($category->name),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
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')
|
* Brands
|
||||||
->whereIntegerInRaw('product_has_relations.product_id', $products)
|
*/
|
||||||
->get(['id', 'parent_id', 'name'])
|
private function categoriesForBrand(int $id)
|
||||||
->unique('categories.id');
|
{
|
||||||
|
return DB::table('categories')
|
||||||
|
->select('categories.id', 'categories.parent_id', 'categories.name')
|
||||||
|
->join('product_has_relations', function ($join) {
|
||||||
|
$join->on('categories.id', '=', 'product_has_relations.productable_id')
|
||||||
|
->where('product_has_relations.productable_type', 'category');
|
||||||
|
})
|
||||||
|
->join('products', 'product_has_relations.product_id', '=', 'products.id')
|
||||||
|
->where('products.brand_id', $id)
|
||||||
|
->where('products.is_visible', true)
|
||||||
|
->whereNull('products.parent_id')
|
||||||
|
->where('products.stock', '>', 0)
|
||||||
|
->where('categories.is_visible', true)
|
||||||
|
->distinct()
|
||||||
|
->get()
|
||||||
|
->map(fn ($category) => [
|
||||||
|
'id' => $category->id,
|
||||||
|
'parent_id' => $category->parent_id,
|
||||||
|
'name' => tr($category->name),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,4 +204,12 @@ class FilterController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->request->filled('brand_id');
|
return $this->request->filled('brand_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if request should be filtered by channel
|
||||||
|
*/
|
||||||
|
private function shouldFilterByChannel(): bool
|
||||||
|
{
|
||||||
|
return $this->request->filled('channel_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Filters\Requests;
|
namespace App\Http\Controllers\Api\V1\Filters\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class FilterIndexRequest extends FormRequest
|
class FilterIndexRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class FilterIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,7 @@ class FilterIndexRequest extends FormRequest
|
|||||||
'collection_id' => ['bail', 'nullable', 'int', 'exists:collections,id'],
|
'collection_id' => ['bail', 'nullable', 'int', 'exists:collections,id'],
|
||||||
'category_id' => ['bail', 'nullable', 'int', 'exists:categories,id'],
|
'category_id' => ['bail', 'nullable', 'int', 'exists:categories,id'],
|
||||||
'brand_id' => ['bail', 'nullable', 'int', 'exists:brands,id'],
|
'brand_id' => ['bail', 'nullable', 'int', 'exists:brands,id'],
|
||||||
|
'channel_id' => ['bail', 'nullable', 'int', 'exists:channels,id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Resources\Products\ProductResource;
|
use App\Http\Resources\Products\ProductResource;
|
||||||
use App\Models\Shop\Product\Product;
|
use App\Models\Shop\Product\Product;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Maize\Markable\Models\Like;
|
use Maize\Markable\Models\Like;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ class LikeController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ class LikeController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ class LikeController extends Controller
|
|||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request)
|
public function destroy(Request $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class OnlinePaymentController extends Controller
|
|||||||
sms_code: $request->sms_code
|
sms_code: $request->sms_code
|
||||||
);
|
);
|
||||||
|
|
||||||
$doc = new \DOMDocument();
|
$doc = new \DOMDocument;
|
||||||
$doc->loadHTML($response->body());
|
$doc->loadHTML($response->body());
|
||||||
|
|
||||||
$inputs = $doc->getElementsByTagName('input');
|
$inputs = $doc->getElementsByTagName('input');
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\V1\Order;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Ecommerce\Product\Order\Shipping\OrderShippingMethod;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class OrderShippingMethodController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Order shipping methods
|
||||||
|
*/
|
||||||
|
public function index(): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->rest(
|
||||||
|
OrderShippingMethod::query()->where('is_active', true)
|
||||||
|
->get(['id', 'name', 'slug', 'price'])
|
||||||
|
->map(fn ($shippingMethod) => [
|
||||||
|
'id' => $shippingMethod->id,
|
||||||
|
'name' => $shippingMethod->name,
|
||||||
|
'slug' => $shippingMethod->slug,
|
||||||
|
'price' => $shippingMethod->price,
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ use App\Models\Ecommerce\Product\Order\Order;
|
|||||||
use App\Repositories\Ecommerce\Order\OrderRepository;
|
use App\Repositories\Ecommerce\Order\OrderRepository;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
@@ -47,14 +48,14 @@ class OrderController extends Controller
|
|||||||
$url = $response['url'];
|
$url = $response['url'];
|
||||||
|
|
||||||
$order->update([
|
$order->update([
|
||||||
'halkbank_id' => $response['orderId']
|
'halkbank_id' => $response['orderId'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->rest([
|
return response()->rest([
|
||||||
'order_id' => $order->id,
|
'order_id' => $order->id,
|
||||||
'payment_url' => $url
|
'payment_url' => $url,
|
||||||
], 201);
|
], 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ class OrderController extends Controller
|
|||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, Order $order): JsonResponse
|
public function update(Request $request, Order $order): JsonResponse
|
||||||
{
|
{
|
||||||
@@ -85,7 +86,7 @@ class OrderController extends Controller
|
|||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Product\Barcode\Requests;
|
namespace App\Http\Controllers\Api\V1\Product\Barcode\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ProductBarcodeSearchIndexRequest extends FormRequest
|
class ProductBarcodeSearchIndexRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class ProductBarcodeSearchIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Product\Resources\Attribute;
|
namespace App\Http\Controllers\Api\V1\Product\Resources\Attribute;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductAttributeProductShowResource extends JsonResource
|
class ProductAttributeProductShowResource extends JsonResource
|
||||||
@@ -9,8 +11,8 @@ class ProductAttributeProductShowResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Product\Resources\Attribute;
|
namespace App\Http\Controllers\Api\V1\Product\Resources\Attribute;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductAttributeResource extends JsonResource
|
class ProductAttributeResource extends JsonResource
|
||||||
@@ -9,8 +11,8 @@ class ProductAttributeResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Api\V1\Product\Resources;
|
|||||||
|
|
||||||
use App\Http\Resources\MediaResource;
|
use App\Http\Resources\MediaResource;
|
||||||
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductIndexResource extends JsonResource
|
class ProductIndexResource extends JsonResource
|
||||||
@@ -11,8 +13,8 @@ class ProductIndexResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ use App\Http\Controllers\Api\V1\Product\Resources\Attribute\ProductAttributeProd
|
|||||||
use App\Http\Controllers\Api\V1\Product\Resources\Variant\ProductVariantResource;
|
use App\Http\Controllers\Api\V1\Product\Resources\Variant\ProductVariantResource;
|
||||||
use App\Http\Resources\Api\V1\Channel\ChannelResource;
|
use App\Http\Resources\Api\V1\Channel\ChannelResource;
|
||||||
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductResource extends JsonResource
|
class ProductResource extends JsonResource
|
||||||
@@ -13,8 +15,8 @@ class ProductResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use App\Http\Controllers\Api\V1\Product\Resources\Variant\ProductVariantResource
|
|||||||
use App\Http\Resources\Api\V1\Channel\ChannelResource;
|
use App\Http\Resources\Api\V1\Channel\ChannelResource;
|
||||||
use App\Http\Resources\MediaResource;
|
use App\Http\Resources\MediaResource;
|
||||||
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductShowResource extends JsonResource
|
class ProductShowResource extends JsonResource
|
||||||
@@ -15,8 +17,8 @@ class ProductShowResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Product\Resources\Review;
|
namespace App\Http\Controllers\Api\V1\Product\Resources\Review;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductReviewResource extends JsonResource
|
class ProductReviewResource extends JsonResource
|
||||||
@@ -9,8 +11,8 @@ class ProductReviewResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request): array
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Api\V1\Product\Resources\Variant;
|
|||||||
|
|
||||||
use App\Http\Controllers\Api\V1\Product\Resources\Attribute\ProductAttributeResource;
|
use App\Http\Controllers\Api\V1\Product\Resources\Attribute\ProductAttributeResource;
|
||||||
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
use App\Repositories\Ecommerce\Product\Property\PropertyRepository;
|
||||||
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class ProductVariantResource extends JsonResource
|
class ProductVariantResource extends JsonResource
|
||||||
@@ -11,8 +13,8 @@ class ProductVariantResource extends JsonResource
|
|||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|||||||
65
app/Http/Controllers/ChatController.php
Normal file
65
app/Http/Controllers/ChatController.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Events\Conversation\MessageSent;
|
||||||
|
use App\Models\Chat\Conversation;
|
||||||
|
use App\Models\Chat\Message;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ChatController extends Controller
|
||||||
|
{
|
||||||
|
public function contacts()
|
||||||
|
{
|
||||||
|
return User::select(['id', 'first_name', 'last_name'])
|
||||||
|
->get()
|
||||||
|
->map(function ($user) {
|
||||||
|
return [
|
||||||
|
'id' => $user->id,
|
||||||
|
'name' => $user->first_name.' '.$user->last_name,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function start(Request $request)
|
||||||
|
{
|
||||||
|
$user1 = auth()->id();
|
||||||
|
$user2 = $request->user_id;
|
||||||
|
|
||||||
|
$conversation = Conversation::whereHas('users', fn ($q) => $q->where('user_id', $user1))
|
||||||
|
->whereHas('users', fn ($q) => $q->where('user_id', $user2))
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (! $conversation) {
|
||||||
|
$conversation = Conversation::create();
|
||||||
|
$conversation->users()->attach([$user1, $user2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $conversation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages($id)
|
||||||
|
{
|
||||||
|
return Message::with('user')
|
||||||
|
->where('conversation_id', $id)
|
||||||
|
->latest()
|
||||||
|
->take(50)
|
||||||
|
->get()
|
||||||
|
->reverse()
|
||||||
|
->values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function send(Request $request)
|
||||||
|
{
|
||||||
|
$message = Message::create([
|
||||||
|
'conversation_id' => $request->conversation_id,
|
||||||
|
'user_id' => auth()->id(),
|
||||||
|
'body' => $request->body,
|
||||||
|
]);
|
||||||
|
|
||||||
|
broadcast(new MessageSent($message))->toOthers();
|
||||||
|
|
||||||
|
return $message->load('user');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ class OnlinePaymentController extends Controller
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'orderId' => ['required', 'string']
|
'orderId' => ['required', 'string'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$resource = Order::query()->where('halkbank_id', $request->orderId)->first();
|
$resource = Order::query()->where('halkbank_id', $request->orderId)->first();
|
||||||
@@ -41,19 +41,19 @@ class OnlinePaymentController extends Controller
|
|||||||
status: $payment_status,
|
status: $payment_status,
|
||||||
message: $payment_status ? 'Töleg geçdi' : 'Töleg geçmedi',
|
message: $payment_status ? 'Töleg geçdi' : 'Töleg geçmedi',
|
||||||
pnr: $response['orderNumber'],
|
pnr: $response['orderNumber'],
|
||||||
price_amount: number_format($response['amount']),
|
price_amount: convertToOriginalFormat($response['amount']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view(
|
public function view(
|
||||||
$status = false,
|
$status,
|
||||||
$message,
|
$message,
|
||||||
string $pnr = '-',
|
string $pnr = '-',
|
||||||
string $branch_name = 'MM.COM.TM',
|
string $branch_name = 'MM.COM.TM',
|
||||||
int|string $price_amount = '-',
|
int|string $price_amount = '-',
|
||||||
string $return_url = 'https://mm.com.tm/orders',
|
string $return_url = 'https://mm.com.tm/orders',
|
||||||
): View {
|
): View {
|
||||||
return view('oninepayment.status', [
|
return view('halkbank.status', [
|
||||||
'success' => $status,
|
'success' => $status,
|
||||||
'title' => $message,
|
'title' => $message,
|
||||||
'pnr' => $pnr,
|
'pnr' => $pnr,
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class TestController extends Controller
|
|||||||
public function ok()
|
public function ok()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (! app()->isProduction()) {
|
if (! app()->isProduction()) {
|
||||||
auth()->login(User::where('email', 'nurmuhammet@mail.com')->first());
|
auth()->login(User::where('email', 'nurmuhammet@mail.com')->first());
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Models\Ecommerce\Channel\Channel;
|
use App\Models\Ecommerce\Channel\Channel;
|
||||||
use App\Repositories\Ecommerce\Product\ProductRepository;
|
use App\Repositories\Ecommerce\Product\ProductRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class EntrepreneurController extends Controller
|
class EntrepreneurController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ class EntrepreneurController extends Controller
|
|||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, $entrepreneur)
|
public function show(Request $request, $entrepreneur)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,33 @@
|
|||||||
|
|
||||||
namespace App\Http;
|
namespace App\Http;
|
||||||
|
|
||||||
|
use App\Http\Middleware\Authenticate;
|
||||||
|
use App\Http\Middleware\CheckApiToken;
|
||||||
|
use App\Http\Middleware\CheckIfUserIsBanned;
|
||||||
|
use App\Http\Middleware\EncryptCookies;
|
||||||
|
use App\Http\Middleware\EnsureUserHasRole;
|
||||||
|
use App\Http\Middleware\PreventRequestsDuringMaintenance;
|
||||||
|
use App\Http\Middleware\RedirectIfAuthenticated;
|
||||||
|
use App\Http\Middleware\SetLanguage;
|
||||||
|
use App\Http\Middleware\TrimStrings;
|
||||||
|
use App\Http\Middleware\TrustProxies;
|
||||||
|
use App\Http\Middleware\ValidateSignature;
|
||||||
|
use App\Http\Middleware\VerifyCsrfToken;
|
||||||
|
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
||||||
|
use Illuminate\Auth\Middleware\Authorize;
|
||||||
|
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
|
||||||
|
use Illuminate\Auth\Middleware\RequirePassword;
|
||||||
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
||||||
|
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
||||||
|
use Illuminate\Http\Middleware\HandleCors;
|
||||||
|
use Illuminate\Http\Middleware\SetCacheHeaders;
|
||||||
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||||
|
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||||
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
|
||||||
class Kernel extends HttpKernel
|
class Kernel extends HttpKernel
|
||||||
{
|
{
|
||||||
@@ -15,12 +41,12 @@ class Kernel extends HttpKernel
|
|||||||
*/
|
*/
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
// \App\Http\Middleware\TrustHosts::class,
|
// \App\Http\Middleware\TrustHosts::class,
|
||||||
\App\Http\Middleware\TrustProxies::class,
|
TrustProxies::class,
|
||||||
\Illuminate\Http\Middleware\HandleCors::class,
|
HandleCors::class,
|
||||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
PreventRequestsDuringMaintenance::class,
|
||||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
ValidatePostSize::class,
|
||||||
\App\Http\Middleware\TrimStrings::class,
|
TrimStrings::class,
|
||||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
ConvertEmptyStringsToNull::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,18 +56,18 @@ class Kernel extends HttpKernel
|
|||||||
*/
|
*/
|
||||||
protected $middlewareGroups = [
|
protected $middlewareGroups = [
|
||||||
'web' => [
|
'web' => [
|
||||||
\App\Http\Middleware\EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
StartSession::class,
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
ThrottleRequests::class.':api',
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -53,19 +79,19 @@ class Kernel extends HttpKernel
|
|||||||
* @var array<string, class-string|string>
|
* @var array<string, class-string|string>
|
||||||
*/
|
*/
|
||||||
protected $middlewareAliases = [
|
protected $middlewareAliases = [
|
||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
'auth' => Authenticate::class,
|
||||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
'auth.basic' => AuthenticateWithBasicAuth::class,
|
||||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
'auth.session' => AuthenticateSession::class,
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
'cache.headers' => SetCacheHeaders::class,
|
||||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
'can' => Authorize::class,
|
||||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
'guest' => RedirectIfAuthenticated::class,
|
||||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
'password.confirm' => RequirePassword::class,
|
||||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
'signed' => ValidateSignature::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => ThrottleRequests::class,
|
||||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
'verified' => EnsureEmailIsVerified::class,
|
||||||
'api_token' => \App\Http\Middleware\CheckApiToken::class,
|
'api_token' => CheckApiToken::class,
|
||||||
'set_lang' => \App\Http\Middleware\SetLanguage::class,
|
'set_lang' => SetLanguage::class,
|
||||||
'banned' => \App\Http\Middleware\CheckIfUserIsBanned::class,
|
'banned' => CheckIfUserIsBanned::class,
|
||||||
'role' => \App\Http\Middleware\EnsureUserHasRole::class,
|
'role' => EnsureUserHasRole::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class CheckApiToken
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class CheckIfUserIsBanned
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class EnsureUserHasRole
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, string $role): Response
|
public function handle(Request $request, Closure $next, string $role): Response
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class RedirectIfAuthenticated
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SetLanguage
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\System\VersionManagement;
|
namespace App\Http\Requests\Api\System\VersionManagement;
|
||||||
|
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ class CheckForUpdateRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Auth;
|
namespace App\Http\Requests\Api\V1\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class AuthLoginRequest extends FormRequest
|
class AuthLoginRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class AuthLoginRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\V1\Auth;
|
namespace App\Http\Requests\Api\V1\Auth;
|
||||||
|
|
||||||
use App\Rules\VerificationRule;
|
use App\Rules\VerificationRule;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class AuthVerifyRequest extends FormRequest
|
class AuthVerifyRequest extends FormRequest
|
||||||
@@ -10,7 +11,7 @@ class AuthVerifyRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
* @return array<string, ValidationRule|array|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\V1\Brand;
|
namespace App\Http\Requests\Api\V1\Brand;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Brand\Brand;
|
use App\Models\Ecommerce\Product\Brand\Brand;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ class BrandIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Brand;
|
namespace App\Http\Requests\Api\V1\Brand;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class BrandProductsRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Cart;
|
namespace App\Http\Requests\Api\V1\Cart;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class CartRemoveRequest extends FormRequest
|
class CartRemoveRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class CartRemoveRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\V1\Cart;
|
namespace App\Http\Requests\Api\V1\Cart;
|
||||||
|
|
||||||
use App\Rules\ProductStockIsAvailable;
|
use App\Rules\ProductStockIsAvailable;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class CartStoreRequest extends FormRequest
|
class CartStoreRequest extends FormRequest
|
||||||
@@ -10,7 +11,7 @@ class CartStoreRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Category;
|
namespace App\Http\Requests\Api\V1\Category;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class CategoryIndexRequest extends FormRequest
|
class CategoryIndexRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class CategoryIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\V1\Forms\ContactUS;
|
namespace App\Http\Requests\Api\V1\Forms\ContactUS;
|
||||||
|
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ class ContactUSStoreRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Forms\Newsletter;
|
namespace App\Http\Requests\Api\V1\Forms\Newsletter;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class NewsletterSubscriptionStoreRequest extends FormRequest
|
class NewsletterSubscriptionStoreRequest extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class NewsletterSubscriptionStoreRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Product;
|
namespace App\Http\Requests\Api\V1\Product;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class BasicProductIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Product;
|
namespace App\Http\Requests\Api\V1\Product;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ProductCommentStore extends FormRequest
|
class ProductCommentStore extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class ProductCommentStore extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Product;
|
namespace App\Http\Requests\Api\V1\Product;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class ProductIndexRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Api\V1\Product\Review;
|
namespace App\Http\Requests\Api\V1\Product\Review;
|
||||||
|
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ class ProductReviewStore extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Api\V1\Product\Review;
|
namespace App\Http\Requests\Api\V1\Product\Review;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ProductReviewUpdate extends FormRequest
|
class ProductReviewUpdate extends FormRequest
|
||||||
@@ -9,7 +10,7 @@ class ProductReviewUpdate extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,19 +4,36 @@ namespace App\Http\Requests;
|
|||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Payment\OrderPayment;
|
use App\Models\Ecommerce\Product\Order\Payment\OrderPayment;
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
||||||
|
use App\Models\Ecommerce\Product\Order\Shipping\OrderShippingMethod;
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use App\Models\System\Settings\Location\Region;
|
use App\Models\System\Settings\Location\Region;
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
class CheckoutOrderRequest extends FormRequest
|
class CheckoutOrderRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Prepare the data for validation.
|
||||||
|
*/
|
||||||
|
protected function prepareForValidation(): void
|
||||||
|
{
|
||||||
|
if (! $this->has('shipping_method_id') && $this->has('shipping_method')) {
|
||||||
|
$method = OrderShippingMethod::query()->where('slug', $this->shipping_method)->first();
|
||||||
|
if ($method) {
|
||||||
|
$this->merge([
|
||||||
|
'shipping_method_id' => $method->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the validator instance.
|
* Configure the validator instance.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Validation\Validator $validator
|
* @param Validator $validator
|
||||||
*/
|
*/
|
||||||
public function withValidator($validator): void
|
public function withValidator($validator): void
|
||||||
{
|
{
|
||||||
@@ -39,16 +56,20 @@ class CheckoutOrderRequest extends FormRequest
|
|||||||
'customer_phone' => ['required', 'integer', 'between:61000000,71999999'],
|
'customer_phone' => ['required', 'integer', 'between:61000000,71999999'],
|
||||||
'customer_address' => ['required', 'string', 'max:255'],
|
'customer_address' => ['required', 'string', 'max:255'],
|
||||||
|
|
||||||
'shipping_method' => ['required', 'string', 'max:255', Rule::in(array_keys(OrderShipping::values()))],
|
'shipping_method_id' => ['required', 'integer', 'exists:order_shipping_methods,id'],
|
||||||
|
'shipping_method' => ['nullable', 'string', 'max:255', Rule::in(array_keys(OrderShipping::values()))],
|
||||||
|
|
||||||
|
'shipping_price' => ['nullable', 'numeric'],
|
||||||
|
'product_ids' => ['required', 'array'],
|
||||||
|
'product_ids.*' => ['required', 'integer', 'exists:products,id'],
|
||||||
|
|
||||||
'payment_type_id' => ['required', Rule::in(array_keys(OrderPayment::values()))],
|
'payment_type_id' => ['required', Rule::in(array_keys(OrderPayment::values()))],
|
||||||
|
|
||||||
'notes' => ['nullable', 'string', 'max:255'],
|
'notes' => ['nullable', 'string', 'max:255'],
|
||||||
'delivery_time' => ['nullable', 'string', 'max:255', Rule::in(array_keys(OrderShipping::times()))],
|
'delivery_time' => ['nullable', 'string', 'max:255', Rule::in(array_keys(OrderShipping::times()))],
|
||||||
'delivery_at' => ['nullable', 'string', 'max:255', 'date'],
|
'delivery_at' => ['nullable', 'string', 'max:255', 'date'],
|
||||||
'region' => ['required', 'string', 'max:255', Rule::in(array_keys(Region::values()))],
|
'region' => ['required', 'string', 'max:255', Rule::in(array_keys(Region::values()))],
|
||||||
'province_id' => ['nullable', Rule::when($this->region !== Region::AG, [
|
'province_id' => ['nullable'],
|
||||||
'integer', 'exists:provinces,id',
|
|
||||||
])],
|
|
||||||
|
|
||||||
'source' => ['nullable', 'string', 'in:site,mobile_app'],
|
'source' => ['nullable', 'string', 'in:site,mobile_app'],
|
||||||
|
|
||||||
@@ -64,13 +85,16 @@ class CheckoutOrderRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
protected function passedValidation(): void
|
protected function passedValidation(): void
|
||||||
{
|
{
|
||||||
|
$shippingMethod = OrderShippingMethod::query()->find($this->shipping_method_id);
|
||||||
|
|
||||||
$this->merge([
|
$this->merge([
|
||||||
'number' => Str::random(30),
|
'number' => Str::random(30),
|
||||||
'status' => OrderStatus::default(),
|
'status' => OrderStatus::default(),
|
||||||
'user_id' => auth()->id(),
|
'user_id' => auth()->id(),
|
||||||
'notes' => $this->notes ?: null,
|
'notes' => $this->notes ?: null,
|
||||||
'province_id' => $this->province_id ?: null,
|
'province_id' => $this->province_id ?: null,
|
||||||
'shipping_price' => OrderShipping::priceFor($this->shipping_method),
|
'shipping_method' => $this->shipping_method ?: $shippingMethod?->slug,
|
||||||
|
'shipping_price' => $this->shipping_price ?: ($shippingMethod?->price ?? 0),
|
||||||
'delivery_time' => $this->delivery_time ?: OrderShipping::MORNING,
|
'delivery_time' => $this->delivery_time ?: OrderShipping::MORNING,
|
||||||
'delivery_at' => $this->delivery_at ?: date('Y-m-d'),
|
'delivery_at' => $this->delivery_at ?: date('Y-m-d'),
|
||||||
'source_app' => $this->source ?: OS::MOBILE_APP,
|
'source_app' => $this->source ?: OS::MOBILE_APP,
|
||||||
@@ -85,9 +109,7 @@ class CheckoutOrderRequest extends FormRequest
|
|||||||
public function messages(): array
|
public function messages(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'shipping_method.in' => sprintf('Valid sources: %s', implode(', ', array_keys(
|
'shipping_method_id.exists' => 'The selected shipping method is invalid.',
|
||||||
OrderShipping::values()
|
|
||||||
))),
|
|
||||||
'payment_type_id.in' => sprintf('Valid sources: %s', implode(', ', array_keys(
|
'payment_type_id.in' => sprintf('Valid sources: %s', implode(', ', array_keys(
|
||||||
OrderPayment::values()
|
OrderPayment::values()
|
||||||
))),
|
))),
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class ChannelResource extends JsonResource
|
|||||||
'sort_order' => $this->whenHas('sort_order'),
|
'sort_order' => $this->whenHas('sort_order'),
|
||||||
'name' => $this->whenHas('name'),
|
'name' => $this->whenHas('name'),
|
||||||
'slug' => $this->whenHas('slug'),
|
'slug' => $this->whenHas('slug'),
|
||||||
|
'shipping_price' => $this->whenHas('shipping_price'),
|
||||||
'description' => $this->whenHas('description'),
|
'description' => $this->whenHas('description'),
|
||||||
'media' => ChannelMediaResource::collection($this->whenLoaded('media')),
|
'media' => ChannelMediaResource::collection($this->whenLoaded('media')),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\Api\V1\Order;
|
namespace App\Http\Resources\Api\V1\Order;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -19,7 +18,7 @@ class OrderIndexResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => OrderStatus::formattedStatusFor($this->status),
|
'status' => OrderStatus::formattedStatusFor($this->status),
|
||||||
'shipping_method' => OrderShipping::formattedShippingMethod($this->shipping_method),
|
'shipping_method' => $this->formattedShippingMethod(),
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
'customer_name' => $this->customer_name,
|
'customer_name' => $this->customer_name,
|
||||||
'customer_phone' => $this->customer_phone,
|
'customer_phone' => $this->customer_phone,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\Api\V1\Vendor\Order;
|
namespace App\Http\Resources\Api\V1\Vendor\Order;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -19,7 +18,7 @@ class VendorOrderIndexResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => OrderStatus::formattedStatusFor($this->status),
|
'status' => OrderStatus::formattedStatusFor($this->status),
|
||||||
'shipping_method' => OrderShipping::formattedShippingMethod($this->shipping_method),
|
'shipping_method' => $this->formattedShippingMethod(),
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
'delivery_time' => $this->delivery_time,
|
'delivery_time' => $this->delivery_time,
|
||||||
'delivery_at' => $this->delivery_at?->format('d.m.Y'),
|
'delivery_at' => $this->delivery_at?->format('d.m.Y'),
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\Api\V1\Vendor\Order;
|
namespace App\Http\Resources\Api\V1\Vendor\Order;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -19,7 +18,7 @@ class VendorOrderShowResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => OrderStatus::formattedStatusFor($this->status),
|
'status' => OrderStatus::formattedStatusFor($this->status),
|
||||||
'shipping_method' => OrderShipping::formattedShippingMethod($this->shipping_method),
|
'shipping_method' => $this->formattedShippingMethod(),
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
'delivery_time' => $this->delivery_time,
|
'delivery_time' => $this->delivery_time,
|
||||||
'delivery_at' => $this->delivery_at,
|
'delivery_at' => $this->delivery_at,
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ class ProductImport implements OnEachRow, WithHeadingRow
|
|||||||
[
|
[
|
||||||
'channel_id' => $this->channel_id,
|
'channel_id' => $this->channel_id,
|
||||||
'ynamdyr_product_code' => $row['product_code'],
|
'ynamdyr_product_code' => $row['product_code'],
|
||||||
'ynamdyr_brand_id' => $row['brand_id'],
|
// 'ynamdyr_brand_id' => $row['brand_id'],
|
||||||
'ynamdyr_category_id' => $row['category_id'],
|
// 'ynamdyr_category_id' => $row['category_id'],
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@@ -113,7 +113,7 @@ class ProductImport implements OnEachRow, WithHeadingRow
|
|||||||
'old_price_amount' => $row['old_price'],
|
'old_price_amount' => $row['old_price'],
|
||||||
'cost_amount' => $row['sale_price'],
|
'cost_amount' => $row['sale_price'],
|
||||||
'price_amount' => $row['sale_price'],
|
'price_amount' => $row['sale_price'],
|
||||||
'is_visible' => false,
|
'is_visible' => true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ class SendOrderCreatedNotification implements ShouldQueue
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sendSMSToClient($event->order);
|
// $this->sendSMSToClient($event->order);
|
||||||
$this->sendSMSToStaff($event->order);
|
// $this->sendSMSToStaff($event->order);
|
||||||
$this->sendSMSToVendors($event->order);
|
// $this->sendSMSToVendors($event->order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,38 +75,38 @@ class SendOrderCreatedNotification implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function sendSMSToStaff($order): void
|
public function sendSMSToStaff($order): void
|
||||||
{
|
{
|
||||||
// $exists = DB::table('order_sent_notifications')
|
$exists = DB::table('order_sent_notifications')
|
||||||
// ->where('order_id', $order->id)
|
->where('order_id', $order->id)
|
||||||
// ->where('phone_number', orderAdminNumber())
|
->where('phone_number', orderAdminNumber())
|
||||||
// ->exists();
|
->exists();
|
||||||
|
|
||||||
// if (! $exists) {
|
if (! $exists) {
|
||||||
// DB::table('order_sent_notifications')
|
DB::table('order_sent_notifications')
|
||||||
// ->insert([
|
->insert([
|
||||||
// 'order_id' => $order->id,
|
'order_id' => $order->id,
|
||||||
// 'phone_number' => orderAdminNumber(),
|
'phone_number' => orderAdminNumber(),
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// sendSMS(
|
sendSMS(
|
||||||
// phone: orderAdminNumber(),
|
phone: orderAdminNumber(),
|
||||||
// message: sprintf(
|
message: sprintf(
|
||||||
// 'Täze sargyt: %s, eltip bermek: %s',
|
'Täze sargyt: %s, eltip bermek: %s',
|
||||||
// $order->id,
|
$order->id,
|
||||||
// $order->shipping_method
|
$order->shipping_method
|
||||||
// )
|
)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// Log::channel('order_sms_notification_sent_activity')
|
Log::channel('order_sms_notification_sent_activity')
|
||||||
// ->info(sprintf('SMS_SENT_FOR_ORDER[id, phone]: %s, %s', $order->id, orderAdminNumber()));
|
->info(sprintf('SMS_SENT_FOR_ORDER[id, phone]: %s, %s', $order->id, orderAdminNumber()));
|
||||||
|
|
||||||
// User::where('phone_number', orderAdminNumber())->first()->notify(
|
User::where('phone_number', orderAdminNumber())->first()->notify(
|
||||||
// NovaNotification::make()
|
NovaNotification::make()
|
||||||
// ->message('Täze sargyt.')
|
->message('Täze sargyt.')
|
||||||
// ->action('Gör', sprintf('/turkmenpostadmin/resources/orders/%s', $order->id))
|
->action('Gör', sprintf('/turkmenpostadmin/resources/orders/%s', $order->id))
|
||||||
// ->icon('download')
|
->icon('download')
|
||||||
// ->type('info')
|
->type('info')
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
22
app/Models/Chat/Conversation.php
Normal file
22
app/Models/Chat/Conversation.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Chat;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Conversation extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public function users()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Message::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/Models/Chat/Message.php
Normal file
17
app/Models/Chat/Message.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Chat;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Message extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -169,7 +169,7 @@ class Channel extends Model implements HasMedia, Sortable
|
|||||||
/**
|
/**
|
||||||
* Channels inventories
|
* Channels inventories
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
// public function inventories(): HasMany
|
// public function inventories(): HasMany
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ trait HasShipping
|
|||||||
*/
|
*/
|
||||||
public function shippingPrice(): int
|
public function shippingPrice(): int
|
||||||
{
|
{
|
||||||
|
if ($this->shippingMethod) {
|
||||||
|
return intval($this->shipping_price) ?: $this->shippingMethod->price;
|
||||||
|
}
|
||||||
|
|
||||||
return intval($this->shipping_price) ?: OrderShipping::priceFor($this->shipping_method);
|
return intval($this->shipping_price) ?: OrderShipping::priceFor($this->shipping_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +23,10 @@ trait HasShipping
|
|||||||
*/
|
*/
|
||||||
public function formattedShippingMethod(): string
|
public function formattedShippingMethod(): string
|
||||||
{
|
{
|
||||||
|
if ($this->shippingMethod) {
|
||||||
|
return $this->shippingMethod->name;
|
||||||
|
}
|
||||||
|
|
||||||
return OrderShipping::formattedShippingMethod($this->shipping_method);
|
return OrderShipping::formattedShippingMethod($this->shipping_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Models\Ecommerce\Product\Order;
|
|||||||
use App\Models\Ecommerce\Product\Order\Concerns\HasPayments;
|
use App\Models\Ecommerce\Product\Order\Concerns\HasPayments;
|
||||||
use App\Models\Ecommerce\Product\Order\Concerns\HasShipping;
|
use App\Models\Ecommerce\Product\Order\Concerns\HasShipping;
|
||||||
use App\Models\Ecommerce\Product\Order\Concerns\HasStatus;
|
use App\Models\Ecommerce\Product\Order\Concerns\HasStatus;
|
||||||
|
use App\Models\Ecommerce\Product\Order\Shipping\OrderShippingMethod;
|
||||||
use App\Models\System\Settings\Location\Province;
|
use App\Models\System\Settings\Location\Province;
|
||||||
use App\Models\System\Settings\Payments\PaymentType;
|
use App\Models\System\Settings\Payments\PaymentType;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -31,6 +32,7 @@ class Order extends Model
|
|||||||
'number',
|
'number',
|
||||||
'status',
|
'status',
|
||||||
'shipping_method',
|
'shipping_method',
|
||||||
|
'shipping_method_id',
|
||||||
'shipping_price',
|
'shipping_price',
|
||||||
'payment_type_id',
|
'payment_type_id',
|
||||||
'notes',
|
'notes',
|
||||||
@@ -40,6 +42,7 @@ class Order extends Model
|
|||||||
'delivery_time',
|
'delivery_time',
|
||||||
'delivery_at',
|
'delivery_at',
|
||||||
'region',
|
'region',
|
||||||
|
'halkbank_id',
|
||||||
'user_id',
|
'user_id',
|
||||||
'additional_tax',
|
'additional_tax',
|
||||||
'province_id',
|
'province_id',
|
||||||
@@ -84,4 +87,12 @@ class Order extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(PaymentType::class, 'payment_type_id');
|
return $this->belongsTo(PaymentType::class, 'payment_type_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shipping method
|
||||||
|
*/
|
||||||
|
public function shippingMethod(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OrderShippingMethod::class, 'shipping_method_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Ecommerce\Product\Order\Shipping;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Sluggable\HasSlug;
|
||||||
|
use Spatie\Sluggable\SlugOptions;
|
||||||
|
use Spatie\Translatable\HasTranslations;
|
||||||
|
|
||||||
|
class OrderShippingMethod extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
use HasSlug;
|
||||||
|
use HasTranslations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'order_shipping_methods';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
'price',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable fields
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
public $translatable = [
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the options for generating the slug.
|
||||||
|
*/
|
||||||
|
public function getSlugOptions(): SlugOptions
|
||||||
|
{
|
||||||
|
return SlugOptions::create()
|
||||||
|
->generateSlugsFrom('name')
|
||||||
|
->saveSlugsTo('slug');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ class LegalPage extends Model
|
|||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @param string|null $field
|
* @param string|null $field
|
||||||
* @return \Illuminate\Database\Eloquent\Model|null
|
* @return Model|null
|
||||||
*/
|
*/
|
||||||
public function resolveRouteBinding($value, $field = null)
|
public function resolveRouteBinding($value, $field = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class GlobalOrderResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Modules\GlobalOrder\Models\GlobalOrder>
|
* @var class-string<GlobalOrder>
|
||||||
*/
|
*/
|
||||||
public static $model = GlobalOrder::class;
|
public static $model = GlobalOrder::class;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
use App\Models\System\Settings\OS;
|
use App\Models\System\Settings\OS;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -18,9 +19,9 @@ class AppTypeFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
use App\Models\System\Settings\Location\Region;
|
use App\Models\System\Settings\Location\Region;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ class RegionFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -20,15 +21,15 @@ class ResourceLimitFilter extends Filter
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
protected $resource
|
protected $resource
|
||||||
) {
|
) {
|
||||||
//...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
use App\Models\Ecommerce\Product\Order\Status\OrderStatus;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ class StatusFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
use App\Models\System\Roles\Role;
|
use App\Models\System\Roles\Role;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ class UserRoleFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -25,9 +26,9 @@ class VerifiedUsersFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Nova\Filters;
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -25,9 +26,9 @@ class VisableFilter extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Nova\Lenses;
|
namespace App\Nova\Lenses;
|
||||||
|
|
||||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Number;
|
use Laravel\Nova\Fields\Number;
|
||||||
@@ -31,7 +32,7 @@ class MostSoldProducts extends Lens
|
|||||||
/**
|
/**
|
||||||
* Get the query builder / paginator for the lens.
|
* Get the query builder / paginator for the lens.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
*/
|
*/
|
||||||
public static function query(LensRequest $request, $query): mixed
|
public static function query(LensRequest $request, $query): mixed
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Nova;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Laravel\Nova\Resource as NovaResource;
|
use Laravel\Nova\Resource as NovaResource;
|
||||||
|
use Laravel\Scout\Builder;
|
||||||
|
|
||||||
abstract class Resource extends NovaResource
|
abstract class Resource extends NovaResource
|
||||||
{
|
{
|
||||||
@@ -46,8 +47,8 @@ abstract class Resource extends NovaResource
|
|||||||
/**
|
/**
|
||||||
* Build a Scout search query for the given resource.
|
* Build a Scout search query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Scout\Builder $query
|
* @param Builder $query
|
||||||
* @return \Laravel\Scout\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function scoutQuery(NovaRequest $request, $query)
|
public static function scoutQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Banner extends Resource
|
|||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Models\CMS\Media\Banner>
|
* @var class-string<BannerModel>
|
||||||
*/
|
*/
|
||||||
public static $model = BannerModel::class;
|
public static $model = BannerModel::class;
|
||||||
|
|
||||||
@@ -156,8 +156,8 @@ class Banner extends Resource
|
|||||||
public function filters(NovaRequest $request): array
|
public function filters(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new VisableFilter(),
|
new VisableFilter,
|
||||||
new AppTypeFilter(),
|
new AppTypeFilter,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ class Carousel extends Resource
|
|||||||
public function filters(NovaRequest $request)
|
public function filters(NovaRequest $request)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new VisableFilter(),
|
new VisableFilter,
|
||||||
new AppTypeFilter(),
|
new AppTypeFilter,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ class Channel extends Resource
|
|||||||
Text::make(__('Description'), 'description')
|
Text::make(__('Description'), 'description')
|
||||||
->rules(['nullable', 'string', 'max:255']),
|
->rules(['nullable', 'string', 'max:255']),
|
||||||
|
|
||||||
|
Text::make('Daswtawka bahasy', 'shipping_price')
|
||||||
|
->rules('nullable', 'numeric'),
|
||||||
|
|
||||||
URL::make('URL'),
|
URL::make('URL'),
|
||||||
Hidden::make('is_default')->default(true),
|
Hidden::make('is_default')->default(true),
|
||||||
Hidden::make('timezone')->default('Asia/Ashgabat'),
|
Hidden::make('timezone')->default('Asia/Ashgabat'),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Nova\Resource;
|
|||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\URL;
|
||||||
|
|
||||||
class AttributeValue extends Resource
|
class AttributeValue extends Resource
|
||||||
{
|
{
|
||||||
@@ -53,7 +54,7 @@ class AttributeValue extends Resource
|
|||||||
* Return the location to redirect the user after creation.
|
* Return the location to redirect the user after creation.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ class AttributeValue extends Resource
|
|||||||
* Return the location to redirect the user after update.
|
* Return the location to redirect the user after update.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterUpdate(NovaRequest $request, $resource)
|
public static function redirectAfterUpdate(NovaRequest $request, $resource)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Nova\Filters\VisableFilter;
|
|||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
||||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Fields\Boolean;
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\HasMany;
|
use Laravel\Nova\Fields\HasMany;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
@@ -80,7 +81,7 @@ class Brand extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Nova\Resources\Ecommerce\Product\Category\Filters;
|
namespace App\Nova\Resources\Ecommerce\Product\Category\Filters;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\Filter;
|
use Laravel\Nova\Filters\Filter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -17,9 +18,9 @@ class Level extends Filter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Nova\Resources\Ecommerce\Product\Category\Filters;
|
namespace App\Nova\Resources\Ecommerce\Product\Category\Filters;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Filters\BooleanFilter;
|
use Laravel\Nova\Filters\BooleanFilter;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
@@ -10,9 +11,9 @@ class RelatedToMarket extends BooleanFilter
|
|||||||
/**
|
/**
|
||||||
* Apply the filter to the given query.
|
* Apply the filter to the given query.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function apply(NovaRequest $request, $query, $value)
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use App\Nova\Permissions\NovaPermission;
|
|||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
||||||
use App\Nova\Resources\Ecommerce\Product\Inventory\Product\ProductResource;
|
use App\Nova\Resources\Ecommerce\Product\Inventory\Product\ProductResource;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Fields\BelongsTo;
|
use Laravel\Nova\Fields\BelongsTo;
|
||||||
use Laravel\Nova\Fields\BelongsToMany;
|
use Laravel\Nova\Fields\BelongsToMany;
|
||||||
use Laravel\Nova\Fields\Boolean;
|
use Laravel\Nova\Fields\Boolean;
|
||||||
@@ -70,8 +71,8 @@ class Inventory extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,21 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Nova\Resources\Ecommerce\Product\Inventory;
|
namespace App\Nova\Resources\Ecommerce\Product\Inventory;
|
||||||
|
|
||||||
|
use App\Models\Ecommerce\Product\Inventory\InventoryHistory;
|
||||||
use App\Models\Ecommerce\Product\Inventory\InventoryHistoryItem;
|
use App\Models\Ecommerce\Product\Inventory\InventoryHistoryItem;
|
||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Fields\BelongsTo;
|
use Laravel\Nova\Fields\BelongsTo;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Number;
|
use Laravel\Nova\Fields\Number;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\URL;
|
||||||
|
|
||||||
class InventoryHistoryItemResource extends Resource
|
class InventoryHistoryItemResource extends Resource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Models\Ecommerce\Product\Inventory\InventoryHistory>
|
* @var class-string<InventoryHistory>
|
||||||
*/
|
*/
|
||||||
public static $model = InventoryHistoryItem::class;
|
public static $model = InventoryHistoryItem::class;
|
||||||
|
|
||||||
@@ -60,8 +63,8 @@ class InventoryHistoryItemResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
@@ -109,7 +112,7 @@ class InventoryHistoryItemResource extends Resource
|
|||||||
* Return the location to redirect the user after creation.
|
* Return the location to redirect the user after creation.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterUpdate(NovaRequest $request, $resource): string
|
public static function redirectAfterUpdate(NovaRequest $request, $resource): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,21 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Nova\Resources\Ecommerce\Product\Inventory;
|
namespace App\Nova\Resources\Ecommerce\Product\Inventory;
|
||||||
|
|
||||||
|
use App\Models\Ecommerce\Product\Inventory\InventoryHistory;
|
||||||
use App\Models\Ecommerce\Product\Inventory\InventoryHistoryRemovedItem;
|
use App\Models\Ecommerce\Product\Inventory\InventoryHistoryRemovedItem;
|
||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
use App\Nova\Resources\Ecommerce\Product\Product\Product;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Laravel\Nova\Fields\BelongsTo;
|
use Laravel\Nova\Fields\BelongsTo;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Number;
|
use Laravel\Nova\Fields\Number;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\URL;
|
||||||
|
|
||||||
class InventoryHistoryRemovedItemResource extends Resource
|
class InventoryHistoryRemovedItemResource extends Resource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Models\Ecommerce\Product\Inventory\InventoryHistory>
|
* @var class-string<InventoryHistory>
|
||||||
*/
|
*/
|
||||||
public static $model = InventoryHistoryRemovedItem::class;
|
public static $model = InventoryHistoryRemovedItem::class;
|
||||||
|
|
||||||
@@ -60,8 +63,8 @@ class InventoryHistoryRemovedItemResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
@@ -109,7 +112,7 @@ class InventoryHistoryRemovedItemResource extends Resource
|
|||||||
* Return the location to redirect the user after creation.
|
* Return the location to redirect the user after creation.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterUpdate(NovaRequest $request, $resource): string
|
public static function redirectAfterUpdate(NovaRequest $request, $resource): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Models\Ecommerce\Product\Product\Product;
|
|||||||
use App\Nova\Repeater\InventoryHistoryItemRepeater;
|
use App\Nova\Repeater\InventoryHistoryItemRepeater;
|
||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@@ -17,13 +18,14 @@ use Laravel\Nova\Fields\ID;
|
|||||||
use Laravel\Nova\Fields\Repeater;
|
use Laravel\Nova\Fields\Repeater;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\URL;
|
||||||
|
|
||||||
class InventoryHistoryRemovedResource extends Resource
|
class InventoryHistoryRemovedResource extends Resource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Models\Ecommerce\Product\Inventory\InventoryHistoryRemoved>
|
* @var class-string<InventoryHistoryRemoved>
|
||||||
*/
|
*/
|
||||||
public static $model = InventoryHistoryRemoved::class;
|
public static $model = InventoryHistoryRemoved::class;
|
||||||
|
|
||||||
@@ -67,8 +69,8 @@ class InventoryHistoryRemovedResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,7 @@ class InventoryHistoryRemovedResource extends Resource
|
|||||||
* Return the location to redirect the user after creation.
|
* Return the location to redirect the user after creation.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Models\Ecommerce\Product\Product\Product;
|
|||||||
use App\Nova\Repeater\InventoryHistoryItemRepeater;
|
use App\Nova\Repeater\InventoryHistoryItemRepeater;
|
||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
use App\Nova\Resources\Ecommerce\Channel\Channel;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@@ -17,13 +18,14 @@ use Laravel\Nova\Fields\ID;
|
|||||||
use Laravel\Nova\Fields\Repeater;
|
use Laravel\Nova\Fields\Repeater;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\URL;
|
||||||
|
|
||||||
class InventoryHistoryResource extends Resource
|
class InventoryHistoryResource extends Resource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The model the resource corresponds to.
|
* The model the resource corresponds to.
|
||||||
*
|
*
|
||||||
* @var class-string<\App\Models\Ecommerce\Product\Inventory\InventoryHistory>
|
* @var class-string<InventoryHistory>
|
||||||
*/
|
*/
|
||||||
public static $model = InventoryHistory::class;
|
public static $model = InventoryHistory::class;
|
||||||
|
|
||||||
@@ -67,8 +69,8 @@ class InventoryHistoryResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query)
|
public static function indexQuery(NovaRequest $request, $query)
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,7 @@ class InventoryHistoryResource extends Resource
|
|||||||
* Return the location to redirect the user after creation.
|
* Return the location to redirect the user after creation.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Resource $resource
|
* @param \Laravel\Nova\Resource $resource
|
||||||
* @return \Laravel\Nova\URL|string
|
* @return URL|string
|
||||||
*/
|
*/
|
||||||
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
public static function redirectAfterCreate(NovaRequest $request, $resource): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class ProductResource extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param Builder $query
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, $query): Builder
|
public static function indexQuery(NovaRequest $request, $query): Builder
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user