I have two table.
this is transaction table:
$table->ulid();
$table->string('payee_user_id', 36);
$table->string('type', 36);
$table->string('terminal_id', 36);
$table->string('terminal_no', 36);
$table->string('terminal_type', 36);
$table->string('acceptor_id', 36);
$table->string('terminal_psp', 36);
$table->string('terminal_provider', 36);
$table->decimal('amount_settle', 15, 2);
$table->decimal('amount_wage', 15, 2);
$table->string('account_id', 36)->nullable();;
$table->string('account_bank_id', 36)->nullable();;
$table->string('account_deposit', 26)->nullable();
$table->string('account_iban', 26)->nullable();
$table->string('wallet_id', 36)->nullable();
$table->timestamp('paid_at', 6);
this is status table:
$table->ulid();
$table->string('transaction_id');
$table->string('status', 36);
$table->string('description', 36)->nullable();
$table->foreign('transaction_id')
->on('transactions')->references('id');
$table->timestamp('created_at', 6)->useCurrent()->index();
any transactions has many statuses.I need to get transactions whose latest status is successful.performance is very important. I do not want eloquent.