add api for harga emas and marhun
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Marhun;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MarhunController extends Controller
|
||||
{
|
||||
|
||||
public function showAllMarhuns()
|
||||
{
|
||||
return response()->json(Marhun::all());
|
||||
}
|
||||
|
||||
public function showOneMarhun($id)
|
||||
{
|
||||
$marhun = Marhun::where('noRujukan','=',$norujukan)->get();
|
||||
return response()->json($marhun);
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
$marhun = Marhun::create($request->all());
|
||||
|
||||
return response()->json($marhun, 201);
|
||||
}
|
||||
|
||||
public function update($id, Request $request)
|
||||
{
|
||||
$marhun = Marhun::findOrFail($id);
|
||||
$marhun->update($request->all());
|
||||
|
||||
return response()->json($marhun, 200);
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
Marhun::findOrFail($id)->delete();
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user