change recent

This commit is contained in:
hafifierahman
2021-01-12 11:46:12 +08:00
parent 80274522b3
commit 7ae83966f7
9 changed files with 213 additions and 7 deletions
@@ -3,8 +3,11 @@
namespace App\Http\Controllers;
use App\HargaEmas;
use Illuminate\Http\Request;
use Carbon\Carbon;
class HargaEmasController extends Controller
{
public function showAllHargaEmas()
@@ -29,6 +32,44 @@ class HargaEmasController extends Controller
return response()->json($harga_emas, 200);
}
public function updatehargaemas(Request $request)
{
$harini = Carbon::now();
$harini = new Carbon;
$hargaemas=HargaEmas::on('mysql7')
->where('recno','=',$request->recno)
->update(array(
'harga'=> $request->harga,
'tarikhupdate' => $harini->toDateString()
));
return response()->json($hargaemas, 200);
}
public function createhargaemas(Request $request)
{
$harini = Carbon::now();
$harini = new Carbon;
$hargaemas=HargaEmas::on('mysql7')
->create([
'karat' => $request->karat,
'keterangan'=> $request->keterangan,
'harga' => $request->harga,
'harga2' => $request->harga2,
'tarikhupdate' => $harini->toDateString()
]);
return response()->json($hargaemas, 201);
}
public function deletehargaemas($id)
{
$jemas = HargaEmas::on('mysql7')->where('recno','=',$id)->delete();
return response('Deleted Successfully', 200);
}
public function showAllHargaEmasMobile(){