I have this code which works fine
public function success(Request $request)
{
$paymentstatus=$request->input('status');
$transactionid=$request->input('txnid');
Ticket::where('transactionid',$transactionid)->update(['paymentstatus'=>$paymentstatus]);
$ticketdata=Ticket::with('eventdetail')->where('transactionid',$transactionid)->first();
$venuename=$ticketdata->eventdetail->venuename;
$eventname=$ticketdata->eventdetail->eventname;
$eventdate=Carbon::parse($ticketdata->eventdetail->eventdate)->format('d M Y');
$myticketdata=array('ticketid'=>'200','class'=>'gold','no_of_persons'=>'10','fullname'=>'tommy dollar','email'=>'[email protected]','mobile'=>'9874563210','transactionid'=>'alskdjflaskjdflakjd');
EmailController::sendemail($ticketdata->email,$myticketdata);
return "success";
}
But I want to send array which is fetched by using below given line
$ticketdata=Ticket::with('eventdetail')->where('transactionid',$transactionid)->first();
So in above function i changed this line to
EmailController::sendemail($ticketdata->email,$ticketdata);
But after executing this code, I get this error

I know this error is because i am not passing array to this function, but I am unable to rectify this code. I also tried to typecast object to array but that did't worked here.