API Flutter Patch 2
This commit is contained in:
parent
59aa63be93
commit
1f7ecb22be
@ -8,20 +8,20 @@ use Illuminate\Http\Request;
|
||||
|
||||
class InvoiceApiController extends Controller
|
||||
{
|
||||
public function getInvoice($id)
|
||||
public function getInvoice(Request $request)
|
||||
{
|
||||
return response()->json([
|
||||
'transaction' => Transaction::findOrFail($id),
|
||||
'transaction' => Transaction::findOrFail($request->input('id')),
|
||||
]);
|
||||
}
|
||||
|
||||
public function exportInvoice($id)
|
||||
public function exportInvoice(Request $request)
|
||||
{
|
||||
// $transaction = Transaction::findOrFail($request->id);
|
||||
// $pdf = Pdf::loadView('invoice.export-invoice',compact('transaction'))->setPaper('A4','Portrait');
|
||||
// return $pdf->download("invoice-$request->id.pdf");
|
||||
return response()->json([
|
||||
'transaction' => Transaction::findOrFail($id),
|
||||
'transaction' => Transaction::findOrFail($request->input('id')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ use App\Models\TransactionDescription;
|
||||
|
||||
class RefundApiController extends Controller
|
||||
{
|
||||
public function createRefund($id)
|
||||
public function createRefund(Request $request)
|
||||
{
|
||||
return response()->json(['transaction_id' => $id]);
|
||||
return response()->json(['transaction_id' => $request->input('id')]);
|
||||
}
|
||||
|
||||
public function storeRefund(Request $request){
|
||||
@ -87,9 +87,9 @@ class RefundApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailRefund($id){
|
||||
$refund = Refund::find($id);
|
||||
$refundDescription = RefundDescription::where('refund_id',$id)->get();
|
||||
public function getDetailRefund(Request $request){
|
||||
$refund = Refund::find($request->input('id'));
|
||||
$refundDescription = RefundDescription::where('refund_id',$request->input('id'))->get();
|
||||
return response()->json([
|
||||
'refund' => $refund,
|
||||
'descriptions' => $refundDescription
|
||||
|
@ -9,19 +9,19 @@ use App\Models\Transaction;
|
||||
|
||||
class TransactionApiController extends Controller
|
||||
{
|
||||
public function getTrackingTransaction($id){
|
||||
$data = TransactionDescription::where('transaction_id', $id)->get();
|
||||
public function getTrackingTransaction(Request $request){
|
||||
$data = TransactionDescription::where('transaction_id', $request->input('id'))->get();
|
||||
|
||||
return response()->json([
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
public function getDetailTransaction($id)
|
||||
public function getDetailTransaction(Request $request)
|
||||
{
|
||||
return response()->json([
|
||||
'transaction' => Transaction::findOrFail($id),
|
||||
'trackings' => TransactionDescription::where('transaction_id', $id)
|
||||
'transaction' => Transaction::findOrFail($request->input('id')),
|
||||
'trackings' => TransactionDescription::where('transaction_id', $request->input('id'))
|
||||
->latest()
|
||||
->get(),
|
||||
]);
|
||||
|
@ -75,14 +75,14 @@ Route::middleware(['auth:api'])->group(function () {
|
||||
}); // sudah
|
||||
|
||||
Route::controller(TransactionApiController::class)->group(function () {
|
||||
Route::get('get-transaction-tracking/{id}', 'getTrackingTransaction')->name('transaction.get-transaction-tracking');
|
||||
Route::get('get-detail-transaction/{id}', 'getDetailTransaction')->name('transaction.get-detail-transaction');
|
||||
Route::get('get-transaction-tracking', 'getTrackingTransaction')->name('transaction.get-transaction-tracking');
|
||||
Route::get('get-detail-transaction', 'getDetailTransaction')->name('transaction.get-detail-transaction');
|
||||
}); // sudah
|
||||
|
||||
Route::controller(RefundApiController::class)->group(function () {
|
||||
Route::get('list-refund', 'listRefund')->name('refund.list-refund');
|
||||
Route::get('create-refund/{id}','createRefund')->name('refund.create-refund');
|
||||
Route::get('detail-refund/{id}','getDetailRefund')->name('refund.get-detail-refund');
|
||||
Route::get('create-refund','createRefund')->name('refund.create-refund');
|
||||
Route::get('detail-refund','getDetailRefund')->name('refund.get-detail-refund');
|
||||
Route::post('store-refund', 'storeRefund')->name('refund.store-refund');
|
||||
}); // sudah
|
||||
|
||||
@ -114,8 +114,8 @@ Route::middleware(['auth:api'])->group(function () {
|
||||
}); // sudah
|
||||
|
||||
Route::controller(InvoiceApiController::class)->group(function () {
|
||||
Route::get('get-invoice/{id}', 'getInvoice')->name('invoice.get-invoice');
|
||||
Route::get('export-invoice/{id}', 'exportInvoice')->name('invoice.export-invoice');
|
||||
Route::get('get-invoice', 'getInvoice')->name('invoice.get-invoice');
|
||||
Route::get('export-invoice', 'exportInvoice')->name('invoice.export-invoice');
|
||||
}); // sudah
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user