I am trying to add or update multiple records i am facing error how can i do that please help me thanks.

please check error <https://flareapp.io/share/q5Yj1VmX#F1>

Method App\Issue::\_\_toString() must not throw an exception, caught Illuminate\Database\Eloquent\JsonEncodingException: Error encoding model [App\Issue] with ID [819] to JSON: Recursion detected

**Controller**

```
 public function issuesUpdate(Request $request, Project $project)
   {
     Issue::WhereNotIn('issue', $request->issue)->delete(); 

    $issues =Issue::where('project_id',$project->id)->get();            
        //for update record 
    foreach($issues as  $key => $value){
        $value->date         =  $request->date[$key];
        $value->issue        =  $value;
        $value->project_id   =  $project->id;
        $value->save();
    }
        //for add new record 
        foreach($request->date  as  $key2 => $val){
            $issue               =  new Issue;
            $issue->date         =  $val;
            $issue->issue        =  $request->issue[$key2];
            $issue->project_id   =  $project->id;
            $issue->save();
        }
         return redirect()->route('project');
}

```

**return response**

```
{
  "_token": "r3CTg9PnUyWo8inwpmWdncV1NcQp18FCyvMI7l3B",
  "date": [
    "2020-08-06",
    "2020-07-09"
  ],
  "issue": [
    "gfhfghgfhdfgdfgdfgfd",
    "dsfsdfds"
  ]
}

```