Skip to content

Commit

Permalink
Upgrade laravel to v11. It uses PostgreSQL v12 instead of v9. Please …
Browse files Browse the repository at this point in the history
…create backuo for PostgreSQL.
  • Loading branch information
Uladzimir Sadkou committed Jul 27, 2024
1 parent 0c6ddfd commit a7eb30d
Show file tree
Hide file tree
Showing 16 changed files with 1,226 additions and 1,625 deletions.
2 changes: 1 addition & 1 deletion app/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Admin extends Authenticatable
/**
* The attributes that are mass assignable.
*
* @var string[]
* @var array<int, string>
*/
protected $fillable = [
'name', 'email', 'password', 'job_title'
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public function index(Request $request, ShippingMethod $shippingMethod, PaymentM
public function addRelated(CartAddRelatedRequest $request): JsonResponse
{
$id = (int)$request->validated()['id'];

$this->cartService->addRelatedProduct($request->user()->id, $id);

return response()->json();
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use App\Events\OrderCreated;
use App\Events\PaymentCreated;
use App\Exceptions\PaymentException;
use App\Http\Requests\CheckoutRequest;
use App\Repositories\OrderRepository;
use App\Services\Cart\CartService;
use App\Services\Payment\PaymentMethodManager;
use App\User;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
Expand Down Expand Up @@ -53,6 +55,9 @@ public function sendPayment(

$subtotal = $requestData['subtotal'];
$user = $request->user();
if (!$user instanceof User) {
throw new PaymentException('Invalid user');
}

$order = $orderRepository->createOrder(
$user,
Expand Down
2 changes: 1 addition & 1 deletion app/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Order extends Model
use HasFactory;

/**
* @var string[]
* @var array<int, string>
*/
protected $fillable = array('commentary', 'total', 'status', 'order_label');

Expand Down
2 changes: 1 addition & 1 deletion app/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PaymentMethod extends Model
use HasFactory;

/**
* @var string[]
* @var array<int, string>
*/
protected $fillable = ['class_name', 'priority', 'config_key', 'enabled', 'label'];
}
2 changes: 1 addition & 1 deletion app/Repositories/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function createOrder(User $user, array $requestData): Order
'order_id' => $order->id,
'payment_method_id' => $requestData['paymentMethodId'],
]);
$order->dispatches()->saveMany([$payment]);
$order->payments()->saveMany([$payment]);
});

return $order;
Expand Down
4 changes: 2 additions & 2 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class User extends Authenticatable
/**
* The attributes that are mass assignable.
*
* @var string[]
* @var array<int, string>
*/
protected $fillable = [
'name', 'email', 'password', 'cart',
Expand All @@ -40,7 +40,7 @@ class User extends Authenticatable
*/
public function orders(): HasMany
{
return $this->hasMany('Order', 'user_id', 'id');
return $this->hasMany(Order::class, 'user_id', 'id');
}

/**
Expand Down
34 changes: 17 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,33 @@
],
"require": {
"php": "^8.2",
"doctrine/dbal": "^3.6.5",
"doctrine/dbal": "^3.8.6",
"giantvlad/braintreehttp": "^0.4.2",
"grpc/grpc": "^1.57.0",
"guzzlehttp/guzzle": "^7.7.0",
"laravel/framework": "^v10.19.0",
"laravel/helpers": "^v1.6.0",
"laravel/octane": "^v1.5.6",
"laravel/tinker": "^v2.8.1",
"laravel/ui": "^v4.2.2",
"guzzlehttp/guzzle": "^7.9.2",
"laravel/framework": "^v11.18.1",
"laravel/helpers": "^v1.7.0",
"laravel/octane": "^v2.5.2",
"laravel/tinker": "^v2.9.0",
"laravel/ui": "^v4.5.2",
"nyholm/psr7": "*",
"paypal/rest-api-sdk-php": "dev-2.0-beta",
"predis/predis": "^v2.2.0",
"sentry/sentry-laravel": "^3.7.3",
"spatie/laravel-ignition": "^2.2.0",
"predis/predis": "^v2.2.2",
"sentry/sentry-laravel": "^4.7.1",
"spatie/laravel-ignition": "^2.8.0",
"spiral/roadrunner": "^v2023.3.10",
"spiral/roadrunner-http": "*",
"spiral/tokenizer": "^3.11.1",
"temporal/sdk": "^v2.7.5",
"spiral/tokenizer": "^3.13.0",
"temporal/sdk": "^v2.10.3",
"twbs/bootstrap": "^v3.4.1"
},
"require-dev": {
"filp/whoops": "~2.15.3",
"mockery/mockery": "^1.6.6",
"nunomaduro/collision": "^v7.8.1",
"nunomaduro/larastan": "^v2.6.4",
"filp/whoops": "~2.15.4",
"mockery/mockery": "^1.6.12",
"nunomaduro/collision": "^v8.3.0",
"nunomaduro/larastan": "^v2.9.8",
"phpunit/phpunit": "^10.3.2",
"fakerphp/faker": "^v1.23.0"
"fakerphp/faker": "^v1.23.1"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit a7eb30d

Please sign in to comment.