feat(stmt_entry): tambahkan model dan migrasi untuk tabel stmt_entry
- Menambahkan model StmtEntry untuk mengelola data entri pernyataan. - Membuat migrasi untuk tabel stmt_entry dengan kolom yang diperlukan. - Menyediakan relasi dengan model Account melalui kolom account_number.
This commit is contained in:
59
app/Models/StmtEntry.php
Normal file
59
app/Models/StmtEntry.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Webstatement\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\Webstatement\Database\Factories\StmtEntryFactory;
|
||||||
|
|
||||||
|
class StmtEntry extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'stmt_entry';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'stmt_entry_id',
|
||||||
|
'account_number',
|
||||||
|
'company_code',
|
||||||
|
'amount_lcy',
|
||||||
|
'transaction_code',
|
||||||
|
'narrative',
|
||||||
|
'product_category',
|
||||||
|
'value_date',
|
||||||
|
'amount_fcy',
|
||||||
|
'exchange_rate',
|
||||||
|
'trans_reference',
|
||||||
|
'booking_date',
|
||||||
|
'stmt_no',
|
||||||
|
'date_time',
|
||||||
|
'currency',
|
||||||
|
'crf_type',
|
||||||
|
'consol_key',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'created_at' => 'datetime',
|
||||||
|
'updated_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function account()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Account::class, 'account_number', 'account_number');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateStmtEntryTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('stmt_entry', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('stmt_entry_id')->nullable();
|
||||||
|
$table->string('account_number')->nullable();
|
||||||
|
$table->string('company_code')->nullable();
|
||||||
|
$table->string('amount_lcy')->nullable();
|
||||||
|
$table->string('transaction_code')->nullable();
|
||||||
|
$table->string('narrative')->nullable();
|
||||||
|
$table->string('product_category')->nullable();
|
||||||
|
$table->string('value_date')->nullable();
|
||||||
|
$table->string('amount_fcy')->nullable();
|
||||||
|
$table->string('exchange_rate')->nullable();
|
||||||
|
$table->string('trans_reference')->nullable();
|
||||||
|
$table->string('booking_date')->nullable();
|
||||||
|
$table->string('stmt_no')->nullable();
|
||||||
|
$table->string('date_time')->nullable();
|
||||||
|
$table->string('currency')->nullable();
|
||||||
|
$table->string('crf_type')->nullable();
|
||||||
|
$table->string('consol_key')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('stmt_entry');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user