php - create() must be of the type array (mailtrap error in laravel)

one text

Solution:

If Complaint is an Eloquent Model you need to pass an array to create not a Request object, $data is a Request. Not sure why you are trying to create 2 complaints (I assume from the same data).

If you need the newly created Complaint model just assign it to $complaint after you create it with the array:

$complaint = Complaint::create([
    'type'          => $data['type'],
    'station'       => $data['station'],
    'description'   => $data['description'],
    'comment'       => $data['comment'],
    'status'        => $data['status'],
    'user_id'       => $data['user_id']
]);

No need for the other call to Complaint::create you have.

Source