add rebet api

This commit is contained in:
LAPTOP-DGCU80CH\user1
2020-11-09 12:28:00 +08:00
parent 6bef37e0bd
commit 361b107531
2 changed files with 53 additions and 0 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\TransaksiKeuntungan;
use Illuminate\Http\Request;
class TransaksiKeuntunganController extends Controller
{
public function getTransaksiKeuntunganByRujukan($norujukan){
$transaksi = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->get();
return response()->json($transaksi);
}
public function createTransaksiKeuntungan(Request $request){
$transaksi = TransaksiKeuntungan::on('mysql7')->create([
'norujukan' => $request->norujukan,
'bayaran_keuntungan' => $request->bayaran_keuntungan,
'tarikh_bayaran'=> $request->tarikh_bayaran,
'tempoh'=> $request->tempoh,
'kodcaw'=> $request->kodcaw
]);
return response()->json($transaksi,201);
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model
{
protected $table = 'transaksi_keuntungan';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'norujukan','bayaran_keuntungan','tarikh_bayaran','tempoh','kodcaw'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}