Kaydet (Commit) 54999e2d authored tarafından Baran Sekin's avatar Baran Sekin

Fixed loop problem

üst 12a010cc
......@@ -11,8 +11,6 @@ use Illuminate\Support\Facades\Validator;
class RoleMappingController extends Controller
{
public function add()
{
$flag = Validator::make(request()->all(), [
......@@ -35,7 +33,6 @@ class RoleMappingController extends Controller
return respond("Rol eşleştirmesi başarıyla eklendi.");
}
public function delete()
{
$flag = Validator::make(request()->all(), [
......
......@@ -17,12 +17,12 @@ class Token extends Model
// $old = Token::where('user_id',($user_id) ? $user_id : auth()->id())->get();
// if($old) $old->destroy();
$token = $token = Str::random(32);
$token = Str::random(32);
while (Token::where('token', $token)->exists()) {
$token = $token = Str::random(32);
$token = Str::random(32);
}
return Token::create([
return Token::firstOrCreate([
"token" => $token,
"user_id" => ($user_id) ? $user_id : auth()->id()
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment