Can’t Insert an array in table column, Laravel

I need to insert an array in a table column with other non array inputs, But each time it’s inserting a string “Array” ,

My codes are :

$post_data['product_category'] = "Goods";
    $post_data['product_profile'] = "physical-goods";

    for ($i = 1; $i < count($request->package_type_id); $i++) {
        $answers[] = [
            $post_data['package_type_id'] =$request->package_type_id,
        ];
    }

   
    $update_product = DB::table('orders')
        ->where('transaction_id', $post_data['tran_id'])
        ->updateOrInsert([
            'name' => $post_data['cus_name'],
            'email' => $post_data['cus_email'],
            'phone' => $post_data['cus_phone'],
            'amount' => $post_data['total_amount'],
            'status' => 'Pending',
            'address' => $post_data['cus_add1'],
            'transaction_id' => $post_data['tran_id'],
            'currency' => $post_data['currency'],
            'package_type_id' =>  implode($answers,',')
        ]);

Answer

You have gone a long way, I think you just want to make a string from the $request->package_type_id which I assume is an array.

$post_data['product_category'] = "Goods";
$post_data['product_profile'] = "physical-goods";

$post_data['package_type_id'] = implode(',', $request->package_type_id);

$update_product = DB::table('orders')
    ->where('transaction_id', $post_data['tran_id'])
    ->updateOrInsert([
        // ...
        'package_type_id' =>  $post_data['package_type_id']
    ]);

Also note that the syntax for implode is implode(glue, array) not the other way around.