芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Http/Controllers/api/v3/seller/auth/LoginController.php
all(), [ 'email' => 'required', 'password' => 'required|min:6' ]); if ($validator->fails()) { return response()->json(['errors' => Helpers::error_processor($validator)], 403); } $data = [ 'email' => $request->email, 'password' => $request->password ]; $seller = Seller::where(['email' => $request['email']])->first(); if (isset($seller) && $seller['status'] == 'approved' && auth('seller')->attempt($data)) { $token = Str::random(50); Seller::where(['id' => auth('seller')->id()])->update(['auth_token' => $token]); if (SellerWallet::where('seller_id', $seller['id'])->first() == false) { DB::table('seller_wallets')->insert([ 'seller_id' => $seller['id'], 'withdrawn' => 0, 'commission_given' => 0, 'total_earning' => 0, 'pending_withdraw' => 0, 'delivery_charge_earned' => 0, 'collected_cash' => 0, 'created_at' => now(), 'updated_at' => now(), ]); } return response()->json(['token' => $token], 200); } else { $errors = []; array_push($errors, ['code' => 'auth-001', 'message' => translate('Invalid credential or account no verified yet')]); return response()->json([ 'errors' => $errors ], 401); } } }