/** @test */ public function verify_loan() { $loan = Loan::find($this->getTestLoanId()); $this->call('PUT', '/class-verify/' . $loan->getAttribute('id'), ['status' => $this->randomCategoryName('loan.status')]); $this->assertResponseOk(); $this->seeJson(); }
/** * Delete the specified resource in storage. * * @param int $id * @return \Illuminate\Http\Response */ public function deleteClassroomBorrow($id) { $affect_row = Loan::where('id', '=', $id)->update(['status' => Category::getCategoryId('loan.status', 'deleted')]); return response()->json(['status' => $affect_row == 1 ? 0 : 2]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroyClassroomBorrow($id) { $affect_rows = Loan::where('id', '=', $id)->where('user_id', '=', Auth::user()->id)->where('loan.status', '=', Category::getCategroyId('loan.status', 'submitted'))->update(['status' => Category::getCategoryId('loan.status', 'canceled')]); return response()->json(['status' => $affect_rows == 1 ? 0 : 2]); }