diff --git a/src/Console/Commands/AbandonedCart.php b/src/Console/Commands/AbandonedCart.php index 0b4ebbe..0054b31 100644 --- a/src/Console/Commands/AbandonedCart.php +++ b/src/Console/Commands/AbandonedCart.php @@ -4,6 +4,7 @@ use Carbon\Carbon; use EscolaLms\Cart\Events\AbandonedCartEvent; +use EscolaLms\Cart\Models\Cart; use EscolaLms\Cart\Services\Contracts\ShopServiceContract; use Illuminate\Console\Command; @@ -21,9 +22,10 @@ public function __construct(ShopServiceContract $shopService) $this->shopService = $shopService; } - public function handle() + public function handle(): void { $abandonedCarts = $this->shopService->getAbandonedCarts(Carbon::now()->subHours(24), Carbon::now()); + /** @var Cart $abandonedCart */ foreach ($abandonedCarts as $abandonedCart) { event(new AbandonedCartEvent($abandonedCart)); } diff --git a/src/Dtos/ProductsSearchDto.php b/src/Dtos/ProductsSearchDto.php index 70936aa..fd68237 100644 --- a/src/Dtos/ProductsSearchDto.php +++ b/src/Dtos/ProductsSearchDto.php @@ -10,12 +10,13 @@ class ProductsSearchDto implements DtoContract protected ?string $type; protected ?bool $free; protected ?string $productable_class; - protected $productable_id; + protected ?int $productable_id; + protected ?string $productable_type; protected ?bool $purchasable = true; protected ?int $per_page; protected ?array $tags; - public function __construct(?string $name = null, ?string $type = null, ?bool $free = null, ?string $productable_type = null, ?int $productable_id = null, ?bool $purchasable = true, ?int $per_page = null, ?array $tags) + public function __construct(?string $name = null, ?string $type = null, ?bool $free = null, ?string $productable_type = null, ?int $productable_id = null, ?bool $purchasable = true, ?int $per_page = null, ?array $tags = null) { $this->name = $name; $this->type = $type; diff --git a/src/EscolaLmsCartServiceProvider.php b/src/EscolaLmsCartServiceProvider.php index 5c4a1cd..f10ec52 100644 --- a/src/EscolaLmsCartServiceProvider.php +++ b/src/EscolaLmsCartServiceProvider.php @@ -30,7 +30,7 @@ class EscolaLmsCartServiceProvider extends ServiceProvider ShopServiceContract::class => ShopService::class, ]; - public function boot() + public function boot(): void { $this->loadRoutesFrom(__DIR__ . '/routes.php'); $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); @@ -41,7 +41,7 @@ public function boot() } } - public function register() + public function register(): void { $this->mergeConfigFrom(__DIR__ . '/config.php', 'escolalms_cart'); @@ -50,7 +50,7 @@ public function register() $this->app->register(SettingsServiceProvider::class); $this->app->register(ScheduleServiceProvider::class); - if (!$this->app->getProviders(EscolaLms\Cart\EscolaLmsTemplatesServiceProvider::class)) { + if (!$this->app->getProviders(EscolaLmsTemplatesServiceProvider::class)) { $this->app->register(EscolaLmsTemplatesServiceProvider::class); } if (!$this->app->getProviders(TreestoneitCartServiceProvider::class)) { diff --git a/src/Http/Controllers/CartApiController.php b/src/Http/Controllers/CartApiController.php index 907b71e..1d7ad46 100644 --- a/src/Http/Controllers/CartApiController.php +++ b/src/Http/Controllers/CartApiController.php @@ -10,6 +10,7 @@ use EscolaLms\Cart\Services\Contracts\ProductServiceContract; use EscolaLms\Cart\Services\Contracts\ShopServiceContract; use EscolaLms\Core\Http\Controllers\EscolaLmsBaseController; +use EscolaLms\Core\Models\User; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -26,13 +27,16 @@ public function __construct(ProductServiceContract $productService, ShopServiceC public function index(Request $request): JsonResponse { - $cart = $this->shopService->cartForUser($request->user()); + /** @var User $user */ + $user = $request->user(); + $cart = $this->shopService->cartForUser($user); return $this->sendResponseForResource($this->shopService->cartAsJsonResource($cart), __("Cart data fetched")); } public function setProductQuantity(ProductSetQuantityInCartRequest $request): JsonResponse { $product = $request->getProduct(); + /** @var User $user */ $user = $request->user(); $cart = $this->shopService->cartForUser($user); if (!$this->productService->productIsBuyableByUser($product, $user, false, $request->getQuantity())) { @@ -46,6 +50,7 @@ public function setProductQuantity(ProductSetQuantityInCartRequest $request): Js public function addMissingProducts(AddMissingProductsRequest $request): JsonResponse { + /** @var User $user */ $user = $request->user(); $cart = $this->shopService->cartForUser($user); $this->shopService->addMissingProductsToCart($cart, $request->input('products', [])); @@ -59,8 +64,10 @@ public function addProductable(ProductableAddToCartRequest $request): JsonRespon if (!$product) { return $this->sendError(__('Single Product for this productable does not exist'), 404); } - $cart = $this->shopService->cartForUser($request->user()); - if (!$this->productService->productIsBuyableByUser($product, $request->user())) { + /** @var User $user */ + $user = $request->user(); + $cart = $this->shopService->cartForUser($user); + if (!$this->productService->productIsBuyableByUser($product, $user)) { return $this->sendError(__("You can not add this product to cart"), 403); } $this->shopService->addProductToCart($cart, $product, 1); @@ -70,6 +77,7 @@ public function addProductable(ProductableAddToCartRequest $request): JsonRespon public function remove(ProductRemoveFromCartRequest $request): JsonResponse { $product = $request->getProduct(); + /** @var User $user */ $user = $request->user(); $cart = $this->shopService->cartForUser($user); return $this->sendResponse( diff --git a/src/Http/Controllers/PaymentApiController.php b/src/Http/Controllers/PaymentApiController.php index d4c01f8..0825d80 100644 --- a/src/Http/Controllers/PaymentApiController.php +++ b/src/Http/Controllers/PaymentApiController.php @@ -7,6 +7,7 @@ use EscolaLms\Cart\Http\Swagger\PaymentSwagger; use EscolaLms\Cart\Services\Contracts\ShopServiceContract; use EscolaLms\Core\Http\Controllers\EscolaLmsBaseController; +use EscolaLms\Core\Models\User; use EscolaLms\Payments\Http\Resources\PaymentResource; use Illuminate\Http\JsonResponse; @@ -22,7 +23,9 @@ public function __construct(ShopServiceContract $shopService) public function pay(PaymentCartRequest $request): JsonResponse { try { - $cart = $this->shopService->cartForUser($request->user()); + /** @var User $user */ + $user = $request->user(); + $cart = $this->shopService->cartForUser($user); $payment = $this->shopService->purchaseCart( $cart, @@ -39,9 +42,11 @@ public function pay(PaymentCartRequest $request): JsonResponse public function payProduct(PaymentProductRequest $request): JsonResponse { try { + /** @var User $user */ + $user = $request->user(); $payment = $this->shopService->purchaseProduct( $request->getProduct(), - $request->user(), + $user, $request->toClientDetailsDto(), $request->getAdditionalPaymentParameters() ); diff --git a/src/Http/Controllers/ProductApiController.php b/src/Http/Controllers/ProductApiController.php index d11758d..9ddce8e 100644 --- a/src/Http/Controllers/ProductApiController.php +++ b/src/Http/Controllers/ProductApiController.php @@ -12,6 +12,7 @@ use EscolaLms\Cart\Services\Contracts\ProductServiceContract; use EscolaLms\Cart\Services\Contracts\ShopServiceContract; use EscolaLms\Core\Http\Controllers\EscolaLmsBaseController; +use EscolaLms\Core\Models\User; use Illuminate\Http\JsonResponse; use EscolaLms\Core\Dtos\OrderDto as SortDto; @@ -48,7 +49,9 @@ public function indexMy(ProductSearchMyRequest $request): JsonResponse public function cancel(ProductRecursiveCancelRequest $request): JsonResponse { - $this->productService->cancelActiveRecursiveProduct($request->getProduct(), $request->user()); + /** @var User $user */ + $user = $request->user(); + $this->productService->cancelActiveRecursiveProduct($request->getProduct(), $user); return $this->sendSuccess(__('Subscription cancelled successfully')); } diff --git a/src/Http/Controllers/ProductablesApiController.php b/src/Http/Controllers/ProductablesApiController.php index 85bae18..5e08e1d 100644 --- a/src/Http/Controllers/ProductablesApiController.php +++ b/src/Http/Controllers/ProductablesApiController.php @@ -7,6 +7,7 @@ use EscolaLms\Cart\Http\Swagger\ProductablesSwagger; use EscolaLms\Cart\Services\Contracts\ProductServiceContract; use EscolaLms\Core\Http\Controllers\EscolaLmsBaseController; +use EscolaLms\Core\Models\User; use Illuminate\Http\JsonResponse; class ProductablesApiController extends EscolaLmsBaseController implements ProductablesSwagger @@ -20,6 +21,7 @@ public function __construct(ProductServiceContract $productService) public function attach(ProductableAttachRequest $request): JsonResponse { + /** @var User $user */ $user = $request->user(); $activeSubscription = $this->productService->hasActiveSubscriptionAllIn($user); diff --git a/src/Http/Requests/Admin/ProductAttachRequest.php b/src/Http/Requests/Admin/ProductAttachRequest.php index 56600e9..51b057c 100644 --- a/src/Http/Requests/Admin/ProductAttachRequest.php +++ b/src/Http/Requests/Admin/ProductAttachRequest.php @@ -10,12 +10,12 @@ class ProductAttachRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return Gate::allows('attach', $this->getProduct()); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -33,12 +33,16 @@ public function rules(): array public function getProductId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getProduct(): Product { - return Product::findOrFail($this->getProductId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getProductId()); + return $product; } public function getCartUser(): User diff --git a/src/Http/Requests/Admin/ProductDeleteRequest.php b/src/Http/Requests/Admin/ProductDeleteRequest.php index d5727e5..5f1fbee 100644 --- a/src/Http/Requests/Admin/ProductDeleteRequest.php +++ b/src/Http/Requests/Admin/ProductDeleteRequest.php @@ -9,12 +9,12 @@ class ProductDeleteRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return Gate::allows('delete', $this->getProduct()); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -31,11 +31,15 @@ public function rules(): array public function getId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getProduct(): Product { - return Product::findOrFail($this->getId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getId()); + return $product; } } diff --git a/src/Http/Requests/Admin/ProductDetachRequest.php b/src/Http/Requests/Admin/ProductDetachRequest.php index c2ae17f..ae49630 100644 --- a/src/Http/Requests/Admin/ProductDetachRequest.php +++ b/src/Http/Requests/Admin/ProductDetachRequest.php @@ -10,12 +10,12 @@ class ProductDetachRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return Gate::allows('detach', $this->getProduct()); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -33,12 +33,16 @@ public function rules(): array public function getProductId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getProduct(): Product { - return Product::findOrFail($this->getProductId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getProductId()); + return $product; } public function getCartUser(): User diff --git a/src/Http/Requests/Admin/ProductReadRequest.php b/src/Http/Requests/Admin/ProductReadRequest.php index 0654b20..53f8e91 100644 --- a/src/Http/Requests/Admin/ProductReadRequest.php +++ b/src/Http/Requests/Admin/ProductReadRequest.php @@ -10,12 +10,12 @@ class ProductReadRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return Gate::allows('view', $this->getProduct()); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -32,11 +32,14 @@ public function rules(): array public function getId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getProduct(): Product { + /** @var Product|null $product */ $product = Product::find($this->getId()); if ($product === null) { diff --git a/src/Http/Requests/Admin/ProductUpdateRequest.php b/src/Http/Requests/Admin/ProductUpdateRequest.php index fbc64a1..dd0ce7b 100644 --- a/src/Http/Requests/Admin/ProductUpdateRequest.php +++ b/src/Http/Requests/Admin/ProductUpdateRequest.php @@ -55,11 +55,15 @@ public function rules(): array public function getId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getProduct(): Product { - return Product::findOrFail($this->getId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getId()); + return $product; } } diff --git a/src/Http/Requests/CartItemRemoveFromCartRequest.php b/src/Http/Requests/CartItemRemoveFromCartRequest.php index 9430b3c..b83055e 100644 --- a/src/Http/Requests/CartItemRemoveFromCartRequest.php +++ b/src/Http/Requests/CartItemRemoveFromCartRequest.php @@ -8,12 +8,12 @@ class CartItemRemoveFromCartRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return !!$this->user(); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -30,6 +30,8 @@ public function rules(): array public function getCartItemId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } } diff --git a/src/Http/Requests/OrderViewRequest.php b/src/Http/Requests/OrderViewRequest.php index 8fd3d66..b059b16 100644 --- a/src/Http/Requests/OrderViewRequest.php +++ b/src/Http/Requests/OrderViewRequest.php @@ -10,12 +10,12 @@ class OrderViewRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return Gate::allows('view', $this->getOrder()); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -23,7 +23,7 @@ protected function prepareForValidation() ]); } - public function rules() + public function rules(): array { return [ 'id' => ['required', 'integer', Rule::exists(Order::class, 'id')], @@ -32,11 +32,14 @@ public function rules() public function getId(): int { - return $this->route('id'); + /** @var int $id */ + $id = $this->route('id'); + return $id; } public function getOrder(): Order { + /** @var Order|null $order */ $order = Order::find($this->getId()); if (is_null($order)) { diff --git a/src/Http/Requests/PaymentProductRequest.php b/src/Http/Requests/PaymentProductRequest.php index 36d707c..f174a04 100644 --- a/src/Http/Requests/PaymentProductRequest.php +++ b/src/Http/Requests/PaymentProductRequest.php @@ -14,6 +14,8 @@ public function getProductId(): int public function getProduct(): Product { - return Product::findOrFail($this->getProductId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getProductId()); + return $product; } } diff --git a/src/Http/Requests/ProductRemoveFromCartRequest.php b/src/Http/Requests/ProductRemoveFromCartRequest.php index 72394e6..77a1086 100644 --- a/src/Http/Requests/ProductRemoveFromCartRequest.php +++ b/src/Http/Requests/ProductRemoveFromCartRequest.php @@ -8,12 +8,12 @@ class ProductRemoveFromCartRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return !!$this->user(); } - protected function prepareForValidation() + protected function prepareForValidation(): void { parent::prepareForValidation(); $this->merge([ @@ -30,11 +30,13 @@ public function rules(): array public function getId(): int { - return $this->input('id'); + return (int) $this->input('id'); } public function getProduct(): Product { - return Product::findOrFail($this->getId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getId()); + return $product; } } diff --git a/src/Http/Requests/ProductRequest.php b/src/Http/Requests/ProductRequest.php index f0f46d9..beb48df 100644 --- a/src/Http/Requests/ProductRequest.php +++ b/src/Http/Requests/ProductRequest.php @@ -21,7 +21,9 @@ public function getId(): int public function getProduct(): Product { - return Product::findOrFail($this->getId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getId()); + return $product; } public function getCartUser(): User diff --git a/src/Http/Requests/ProductSetQuantityInCartRequest.php b/src/Http/Requests/ProductSetQuantityInCartRequest.php index 2084ac4..9aaecf1 100644 --- a/src/Http/Requests/ProductSetQuantityInCartRequest.php +++ b/src/Http/Requests/ProductSetQuantityInCartRequest.php @@ -8,7 +8,7 @@ class ProductSetQuantityInCartRequest extends FormRequest { - public function authorize() + public function authorize(): bool { return $this->user()->can('buy', $this->getProduct()); } @@ -23,6 +23,7 @@ public function rules(): array public function getMaxQuantityRule(): array { + /** @var Product|null $product */ $product = Product::find($this->input('id')); if (!$product || is_null($product->limit_per_user)) { @@ -34,12 +35,14 @@ public function getMaxQuantityRule(): array public function getId(): int { - return $this->input('id'); + return (int) $this->input('id'); } public function getProduct(): Product { - return Product::findOrFail($this->getId()); + /** @var Product $product */ + $product = Product::findOrFail($this->getId()); + return $product; } public function getQuantity(): int diff --git a/src/Http/Resources/BaseProductResource.php b/src/Http/Resources/BaseProductResource.php index 2590b29..c0290b8 100644 --- a/src/Http/Resources/BaseProductResource.php +++ b/src/Http/Resources/BaseProductResource.php @@ -6,6 +6,7 @@ use EscolaLms\Cart\Models\ProductProductable; use EscolaLms\Cart\Services\Contracts\ProductServiceContract; use EscolaLms\Categories\Http\Resources\CategoryResource; +use EscolaLms\Core\Models\User; use EscolaLms\Tags\Models\Tag; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Support\Facades\Auth; @@ -24,7 +25,8 @@ protected function getProduct(): Product public function toArray($request): array { - $user = $request ? $request->user() : Auth::user(); + /** @var User $user */ + $user = $request->user() ?? Auth::user(); $data = [ 'id' => $this->getProduct()->getKey(), 'type' => $this->getProduct()->type, @@ -43,8 +45,8 @@ public function toArray($request): array 'teaser_url' => $this->getProduct()->teaser_url, 'poster_path' => $this->getProduct()->getPosterUrlOrProductableThumbnailAttribute(), 'poster_url' => $this->getProduct()->poster_absolute_url, - 'buyable' => $user ? $this->getProduct()->getBuyableByUserAttribute($user) : false, - 'owned' => $user ? $this->getProduct()->getOwnedByUserAttribute($user) : false, + 'buyable' => $user && $this->getProduct()->getBuyableByUserAttribute($user), + 'owned' => $user && $this->getProduct()->getOwnedByUserAttribute($user), 'owned_quantity' => $user ? $this->getProduct()->getOwnedByUserQuantityAttribute($user) : 0, 'categories' => CategoryResource::collection($this->getProduct()->categories)->toArray($request), 'tags' => $this->getProduct()->tags->map(fn (Tag $tag) => $tag->title)->toArray(), diff --git a/src/Http/Resources/OrderExportResource.php b/src/Http/Resources/OrderExportResource.php index 1d8f7b9..3ad8eaa 100644 --- a/src/Http/Resources/OrderExportResource.php +++ b/src/Http/Resources/OrderExportResource.php @@ -21,23 +21,23 @@ protected function getOrder(): Order public function toArray($request): array { return [ - 'id' => $this->resource->getKey(), - 'status' => OrderStatus::getName($this->status), + 'id' => $this->getOrder()->getKey(), + 'status' => OrderStatus::getName($this->getOrder()->status), 'items' => OrderItemExportResource::collection($this->getOrder()->items), - 'total' => $this->total, - 'subtotal' => $this->subtotal, - 'tax' => $this->tax, - 'created_at' => $this->created_at, - 'user_id' => $this->user_id, - 'client_name' => $this->client_name, - 'client_email' => $this->client_email, - 'client_street' => $this->client_street, - 'client_street_number' => $this->client_street_number, - 'client_postal' => $this->client_postal, - 'client_city' => $this->client_city, - 'client_country' => $this->client_country, - 'client_company' => $this->client_company, - 'client_taxid' => $this->client_taxid, + 'total' => $this->getOrder()->total, + 'subtotal' => $this->getOrder()->subtotal, + 'tax' => $this->getOrder()->tax, + 'created_at' => $this->getOrder()->created_at, + 'user_id' => $this->getOrder()->user_id, + 'client_name' => $this->getOrder()->client_name, + 'client_email' => $this->getOrder()->client_email, + 'client_street' => $this->getOrder()->client_street, + 'client_street_number' => $this->getOrder()->client_street_number, + 'client_postal' => $this->getOrder()->client_postal, + 'client_city' => $this->getOrder()->client_city, + 'client_country' => $this->getOrder()->client_country, + 'client_company' => $this->getOrder()->client_company, + 'client_taxid' => $this->getOrder()->client_taxid, ]; } } diff --git a/src/Http/Resources/OrderResource.php b/src/Http/Resources/OrderResource.php index 42a9946..1db35b1 100644 --- a/src/Http/Resources/OrderResource.php +++ b/src/Http/Resources/OrderResource.php @@ -30,23 +30,23 @@ protected function getOrderItemsResourceCollection(): ResourceCollection public function toArray($request): array { return self::apply([ - 'id' => $this->resource->getKey(), - 'status' => OrderStatus::getName($this->status), + 'id' => $this->getOrder()->getKey(), + 'status' => OrderStatus::getName($this->getOrder()->status), 'items' => $this->getOrderItemsResourceCollection(), - 'total' => $this->total, - 'subtotal' => $this->subtotal, - 'tax' => $this->tax, - 'created_at' => $this->created_at, - 'user_id' => $this->user_id, - 'client_name' => $this->client_name, - 'client_email' => $this->client_email, - 'client_street' => $this->client_street, - 'client_street_number' => $this->client_street_number, - 'client_postal' => $this->client_postal, - 'client_city' => $this->client_city, - 'client_country' => $this->client_country, - 'client_company' => $this->client_company, - 'client_taxid' => $this->client_taxid, + 'total' => $this->getOrder()->total, + 'subtotal' => $this->getOrder()->subtotal, + 'tax' => $this->getOrder()->tax, + 'created_at' => $this->getOrder()->created_at, + 'user_id' => $this->getOrder()->user_id, + 'client_name' => $this->getOrder()->client_name, + 'client_email' => $this->getOrder()->client_email, + 'client_street' => $this->getOrder()->client_street, + 'client_street_number' => $this->getOrder()->client_street_number, + 'client_postal' => $this->getOrder()->client_postal, + 'client_city' => $this->getOrder()->client_city, + 'client_country' => $this->getOrder()->client_country, + 'client_company' => $this->getOrder()->client_company, + 'client_taxid' => $this->getOrder()->client_taxid, ], $this); } } diff --git a/src/Http/Resources/ProductDetailedResource.php b/src/Http/Resources/ProductDetailedResource.php index 0b71385..cb9ccc0 100644 --- a/src/Http/Resources/ProductDetailedResource.php +++ b/src/Http/Resources/ProductDetailedResource.php @@ -11,7 +11,8 @@ class ProductDetailedResource extends ProductResource { public function toArray($request): array { - $user = $request ? $request->user() : Auth::user(); + /** @var User $user */ + $user = $request->user() ?? Auth::user(); $result = parent::toArray($request); if ($user->can(AuthPermissionsEnum::USER_LIST)) { $result['users'] = $this->getProduct()->users->map(fn (User $user) => ['id' => $user->getKey(), 'email' => $user->email, 'name' => $user->name])->toArray(); diff --git a/src/Jobs/RenewRecursiveProductUser.php b/src/Jobs/RenewRecursiveProductUser.php index 6a62533..a428618 100644 --- a/src/Jobs/RenewRecursiveProductUser.php +++ b/src/Jobs/RenewRecursiveProductUser.php @@ -38,7 +38,9 @@ public function getProductUser(): ProductUser public function handle(OrderServiceContract $orderService): void { + /** @var Product $product */ $product = Product::find($this->productUser->product_id); + /** @var User $user */ $user = User::find($this->productUser->user_id); /** @var Order $order */