obi101's avatar

array_key_exists(): The first argument should be either a string or an integer

Hey, i'm having this problem . I get this message as response to a xhr request :

"message": "array_key_exists(): The first argument should be either a string or an integer",
    "exception": "ErrorException",
    "file": "C:\Users\op\Desktop\PFE\VT_webApp\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php",
    "line": 356,
    "trace": [

I went through the trace object looking for a file I wrote and found this line

{
            "file": "-----\app\Http\Controllers\ProfController.php",
            "line": 427,
            "function": "where",
            "class": "Illuminate\Support\Collection",
            "type": "->"
        },

the line correspond to this, both $etudiant and "->absences" are eloquent models

424$absence = $etudiant->absences->where([
425['dateDebut' , '=' , $dateSeance],
426['heureDebut' , '=' , $heuredebut],
427['heureFin', '=' , $heureFin],
428]);

Thank you in advance.

0 likes
1 reply
obi101's avatar
obi101
OP
Best Answer
Level 1

I just found the solution , deleting those [ ] wrapping the conditions

424$absence = $etudiant->absences->where(
425['dateDebut' , '=' , $dateSeance],
426['heureDebut' , '=' , $heuredebut],
427['heureFin', '=' , $heureFin],
428);

Please or to participate in this conversation.