45 lines
656 B
Plaintext
45 lines
656 B
Plaintext
|
|
public function scanMember(Request $request)
|
|
{
|
|
|
|
$uid = $request->uid;
|
|
|
|
$member = Member::where('uid_card',$uid)->first();
|
|
|
|
if(!$member){
|
|
return response()->json([
|
|
"status"=>"not_found"
|
|
]);
|
|
}
|
|
|
|
$approved = BorrowTransaction::where('member_id',$member->id)
|
|
->where('status','approved')
|
|
->count();
|
|
|
|
$borrowed = BorrowTransaction::where('member_id',$member->id)
|
|
->where('status','borrowed')
|
|
->count();
|
|
|
|
if($approved > 0){
|
|
|
|
return response()->json([
|
|
"status"=>"pickup",
|
|
"member_id"=>$member->id
|
|
]);
|
|
|
|
}
|
|
|
|
if($borrowed > 0){
|
|
|
|
return response()->json([
|
|
"status"=>"return",
|
|
"member_id"=>$member->id
|
|
]);
|
|
|
|
}
|
|
|
|
return response()->json([
|
|
"status"=>"no_transaction"
|
|
]);
|
|
|
|
} |