Block staff id from register
This commit is contained in:
@@ -7,6 +7,7 @@ use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Staff;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@@ -25,8 +26,6 @@ class AuthController extends Controller
|
||||
'register_agree' => 'required|integer',
|
||||
'alamat' => 'required'
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if ($validator->fails()) {
|
||||
$errors = [
|
||||
@@ -37,6 +36,18 @@ class AuthController extends Controller
|
||||
}
|
||||
// Retrieve the validated input...
|
||||
$fields = $validator->validated();
|
||||
|
||||
$convert_ic_to_hyphen = (substr_replace(substr_replace($fields['nokp'], '-', 6, 0), '-', 9, 0));
|
||||
$check_staff = Staff::where('nokp', '=', $convert_ic_to_hyphen)->first();
|
||||
if($check_staff)
|
||||
{
|
||||
$errors = [
|
||||
'success' => "Staff",
|
||||
'message' => "Staff tidak dibenarkan mendaftar."
|
||||
];
|
||||
return response($errors, 201);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
|
||||
Reference in New Issue
Block a user