Skip to content

Commit 1be5ff6

Browse files
authored
Merge pull request #52 from majidalaeinia/master
Resolve migration to read from config instead of env file
2 parents f1e5f4e + 680f555 commit 1be5ff6

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ php artisan migrate
8080
## Configuration
8181
If you complete installation step correctly, you can find Larapay config file as larapay.php in you project config file.
8282

83-
For sandbox (banktest) you should set ```LARAPAY_MODE=development``` in your .env file otherwise set ```LARAPAY_MODE=production```
83+
For sandbox (banktest) you should set `LARAPAY_MODE=development` in your .env file otherwise set `LARAPAY_MODE=production`
8484

85-
If you choose development mode, Larapay use banktest.ir as it's payment gateway.
85+
If you choose development mode, Larapay use banktest.ir as its payment gateway.
8686

8787
Set your gateway(s) configs in your .env file. Here are some example:
8888
```ini

config/larapay.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*
66
|--------------------------------------------------------------------------
7-
| PhpMonsters e-payment component`s operation mode
7+
| PhpMonsters e-payment components operation mode
88
|--------------------------------------------------------------------------
99
|
1010
| *** very important config ***
@@ -198,11 +198,11 @@
198198
),
199199
],
200200
],
201+
201202
/*
202203
|--------------------------------------------------------------------------
203204
| Route name for handle payment callback
204205
|--------------------------------------------------------------------------
205206
*/
206-
207207
'payment_callback' => env('LARAPAY_PAYMENT_CALLBACK' , '')
208208
];

database/migrations/create_larapay_transaction_table.php.stub

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ class CreateLarapayTransactionTable extends Migration
1010
/**
1111
* Run the migrations.
1212
*/
13-
public function up()
13+
public function up(): void
1414
{
1515
Schema::create('larapay_transactions', function (Blueprint $table) {
16-
17-
//primary key
1816
$table->increments('id');
1917

2018
//morph to model like order or user
@@ -40,11 +38,11 @@ class CreateLarapayTransactionTable extends Migration
4038
$table->text('description')->nullable();
4139
$table->bigInteger('amount')->default(0);
4240

43-
if (env('DB_CONNECTION') == 'pgsql') { // for POSTGRESQL
41+
if (config('database.default') == 'pgsql') {
4442
$table->jsonb('extra_params')->nullable()->default('{}');
4543
$table->jsonb('additional_data')->nullable()->default('{}');
4644
$table->jsonb('sharing')->nullable()->default('{}');
47-
} else { // for MYSQL
45+
} else {
4846
$table->jsonb('extra_params')->nullable();
4947
$table->jsonb('additional_data')->nullable();
5048
$table->jsonb('sharing')->nullable();
@@ -59,7 +57,7 @@ class CreateLarapayTransactionTable extends Migration
5957
/**
6058
* Reverse the migrations.
6159
*/
62-
public function down()
60+
public function down(): void
6361
{
6462
Schema::dropIfExists('larapay_transactions');
6563
}

0 commit comments

Comments
 (0)