Skip to content

Commit 0a2c416

Browse files
done
1 parent 0906161 commit 0a2c416

17 files changed

Lines changed: 245 additions & 77 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
use Illuminate\Http\Request;
5+
use App\Services\WithdrawMethodService;
6+
7+
class WithdrawMethodController extends Controller {
8+
9+
public function __construct ( WithdrawMethodService $withdrawMethodService ) {
10+
11+
parent::__construct($withdrawMethodService);
12+
13+
}
14+
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
use Illuminate\Http\Request;
5+
use App\Http\Requests\WithdrawTransactionRequest;
6+
use App\Services\WithdrawTransactionService;
7+
8+
class WithdrawTransactionController extends Controller {
9+
10+
protected function requestForm () { return WithdrawTransactionRequest::class; }
11+
12+
public function __construct ( WithdrawTransactionService $withdrawTransactionService ) {
13+
14+
parent::__construct($withdrawTransactionService);
15+
16+
}
17+
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Http\Requests;
4+
5+
class WithdrawTransactionRequest extends BaseRequest {
6+
7+
public function rules () {
8+
9+
return [
10+
'related' => $this->stringRule(),
11+
'name' => $this->nameRule(),
12+
'code' => [...$this->stringRule(), ...$this->uniqueRule( 'withdraw_transactions', 'code' )],
13+
'status' => $this->enumRule( ['valid', 'invalid', 'none'] ),
14+
'owner_id' => $this->existsRule( 'users', 'id' ),
15+
'parent_id' => $this->existsRule( 'withdraw_transactions', 'id' ),
16+
];
17+
18+
}
19+
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Http\Resources;
4+
5+
class WithdrawMethodResource extends BaseResource {
6+
7+
protected bool $hasImage = true;
8+
9+
public function tiny ( $data ) {
10+
11+
return [
12+
'name' => $data->name,
13+
'fields' => $data->fields,
14+
];
15+
16+
}
17+
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Resources;
4+
5+
class WithdrawTransactionResource extends BaseResource {
6+
7+
public function tiny ( $data ) {
8+
9+
return [
10+
'amount' => $data->amount,
11+
'currency' => $data->currency,
12+
'status' => $data->status,
13+
];
14+
15+
}
16+
public function data () {
17+
18+
return [
19+
'recipient' => $this->recipient,
20+
'deleted' => $this->deleted,
21+
];
22+
23+
}
24+
public function relations () {
25+
26+
return [
27+
'method' => WithdrawMethodResource::info( $this->withdrawMethod ),
28+
];
29+
30+
}
31+
32+
}

app/Models/WithdrawMethod.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Models;
4+
use Illuminate\Database\Eloquent\Model;
5+
use App\Traits\Model\HasBaseModel;
6+
7+
class WithdrawMethod extends Model {
8+
9+
use HasBaseModel;
10+
11+
}

app/Models/WithdrawTransaction.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Models;
4+
use Illuminate\Database\Eloquent\Model;
5+
use App\Traits\Model\HasBaseModel;
6+
7+
class WithdrawTransaction extends Model {
8+
9+
use HasBaseModel;
10+
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Repositories;
4+
use App\Models\WithdrawMethod;
5+
6+
class WithdrawMethodRepository extends BaseRepository {
7+
8+
public function __construct ( WithdrawMethod $model ) { parent::__construct($model); }
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Repositories;
4+
use App\Models\WithdrawTransaction;
5+
6+
class WithdrawTransactionRepository extends BaseRepository {
7+
8+
public function __construct ( WithdrawTransaction $model ) { parent::__construct($model); }
9+
10+
}

app/Services/SeedingService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function settings ( Store $store ) {
6464
public function gateways ( Store $store ) {
6565

6666
collect(config('settings.gateways', []))->each(fn( $config, $name ) =>
67-
$this->gatewayRepository->firstOrCreate([
67+
$this->gatewayRepository->updateOrCreate([
6868
'store_id' => $store->id,
6969
'name' => $config['name'] ?? $name
7070
], $config, boot: false, strict: false)

0 commit comments

Comments
 (0)