added credit limit seeder, it causes error when creating booking

This commit is contained in:
Jack Goh
2018-06-25 17:48:51 +08:00
parent 62d0d83cb6
commit ffe1023bba
3 changed files with 29 additions and 1 deletions
+6 -1
View File
@@ -165,7 +165,12 @@ class BookingController extends Controller
$rates = Rate::orderby('updated_at','desc')->first();
$term = $request->input('term');
$amount = $request->input("amount"); // in RMB
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
if (!$creditLimit){
return response()->json("Credit limit not set, please contact admin", 405);
}
if($amount > $creditLimit->rmb_credit_limit){
return response()->json("Exceed credit limit, need approved from admin", 401);
}