HI there I have a table that I run a query on to get all the users records in the table and then I return a datatable with the data. This works 100%. My problem is I need to add data to this datatable from another table in the db as well currently I have tried the following but I just get a datatable error. Both tables structure is the same. And I just can't get the table to display the information of both tables.
public function kryAandele()
{
$user = Auth::user();
$share = $user->shares()->where('status_id',3)->get();
$alternates = $user->alternates()->where('status_id', 3)->get();
$shares = $share->merge($alternates);
return DataTables::of($shares)->editColumn('created_at', function (Share $share){
return $share->created_at->toDateString();
})->editColumn('status_id', function (Share $share){
return $share->status->name;
})->editColumn('sert_nommer', function (Share $share){
return strval($share->sert_nommer);
})->toJson();
}