-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from andes2912/feature/spp
Tambah Akun Bank
- Loading branch information
Showing
13 changed files
with
534 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Backend; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\Bank; | ||
use ErrorException; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Session; | ||
use Modules\SPP\Entities\BankAccount; | ||
|
||
class SettingController extends Controller | ||
{ | ||
// setting | ||
public function index() | ||
{ | ||
$bank = Bank::all(); | ||
return view('backend.settings.index', compact('bank')); | ||
} | ||
|
||
// Tambah Bank | ||
public function addBank(Request $request) | ||
{ | ||
try { | ||
BankAccount::create([ | ||
'user_id' => Auth::id(), | ||
'account_number' => $request->account_number, | ||
'account_name' => $request->account_name, | ||
'bank_name' => $request->bank_name, | ||
'is_active' => $request->is_active, | ||
'is_primary' => 1 | ||
]); | ||
Session::flash('success','Akun Bank Berhasil Ditambah.'); | ||
return back(); | ||
} catch (\ErrorException $e) { | ||
throw new ErrorException($e->getMessage()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the IndoBank package. | ||
* | ||
* (c) Andri Desmana <andridesmana.pw | andridesmana29@gmail.com> | ||
* | ||
*/ | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* Bank Model. | ||
*/ | ||
class Bank extends Model | ||
{ | ||
/** | ||
* Table name. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'banks'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
database/migrations/2021_08_08_100000_create_banks_tables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the IndoBank package. | ||
* | ||
* (c) Andri Desmana <andridesmana.pw | andridesmana29@gmail.com> | ||
* | ||
*/ | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateBanksTables extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('banks', function(Blueprint $table){ | ||
$table->id(); | ||
$table->string('sandi_bank',20); | ||
$table->string('nama_bank'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('banks'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the IndoBank package. | ||
* | ||
* (c) Andri Desmana <andridesmana.pw | andridesmana29@gmail.com> | ||
* | ||
*/ | ||
|
||
namespace Database\Seeders; | ||
|
||
use Illuminate\Database\Seeder; | ||
use Andes2912\IndoBank\RawDataGetter; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class IndoBankSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
* | ||
* @deprecated | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
// Get Data | ||
$banks = RawDataGetter::getBanks(); | ||
|
||
// Insert Data to Database | ||
DB::table('banks')->insert($banks); | ||
} | ||
} |
Oops, something went wrong.