mostafalaravel
7 months ago

seed error : Array to string conversion ...

Posted 7 months ago by mostafalaravel

Hello ,

this is my seed class bellow , when I run :

php artisan db:seed --class=Action_detailsTableSeeder

it returns me :

  Array to string conversion (SQL: insert into `action_details` (`action_number`, `nofab`, `nofac_description`, `action_name`, `startdate`, `enddate`, `extensiondate`, `is_cashback`, `minimum_value`, `maximum_value`, `is_expedition`, `action_type`, `action_descr  
  iption_nl`, `action_description_fr`, `action_po_box`, `generic_brand`, `detailed_brand`, `distribution_1`, `distribution_2`, `nielsen_1`, `nielsen_2`, `nielsen_3`, `extract_communication_fr`, `extract_communictation_nl`, `delete_byte`, `view_participations`, `  
  export_participations`, `view_statistics`, `export_statistics`, `status`, `clearing`, `bon_number`, `emission_quantity`, `estimated_redemption`, `redemption_to_date`, `dr_reference`, `vat_rate`, `hon_reference`, `first_coupon_date`, `briefing_date`, `productio  
  n_date`, `action_fed`, `web_url`) values (20868, 47312, omnis, ratione, 20190307, 20190308, 20190310, Rye, 6, 26, Melton West, est, aut, tempore, 66273-6978, Muller-Bashirian, incidunt, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, Melton West, xx, not dispo  
  nible, xx, xx, 20190309, xx, xxx, xxx, 20190306, 20190307, 20190307, xx, http://jaskolski.info/))                                                                                                                                                                     
                                                                                                                                                                                                                                                                        
<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Faker\Factory as Faker;


class Action_detailsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $faker = Faker::create();
        foreach (range(1, 1) as $index) {
            DB::table('action_details')->insert([
                    'action_number' => rand(10000,99999)      ,
                    'nofab' => rand(10000,99999)     ,
                    'nofac_description' => $faker-> words(5)     ,
                    'action_name' => $faker->word(3)      ,
                    'startdate' => date('Ymd')      ,
                    'enddate' => date('Ymd', strtotime("+1 day"))     ,
                    'extensiondate' => date('Ymd', strtotime("+3 day"))      ,
                    'is_cashback' => $faker->randomElement(['Melton South','Melton West','Rye'])   ,
                    'minimum_value' => rand(1,10)     ,
                    'maximum_value' => rand(20,30)      ,
                    'is_expedition' => $faker->randomElement(['Melton South','Melton West','Rye'])     ,
                    'action_type' => $faker->word(6)      ,
                    'action_description_nl' => $faker->words(5)      ,
                    'action_description_fr' => $faker->words(6)      ,
                    'action_po_box' => $faker->postcode      ,
                    'generic_brand' => $faker->company      ,
                    'detailed_brand' => $faker->words(7)     ,
                    'distribution_1' => 'xx'     ,
                    'distribution_2' => 'xx'     ,
                    'nielsen_1' => 'xx'     ,
                    'nielsen_2' => 'xx'     ,
                    'nielsen_3' => 'xx'     ,
                    'extract_communication_fr' => 'xx'      ,
                    'extract_communictation_nl' => 'xx'     ,
                    'delete_byte' => 'xx'      ,
                    'view_participations' => 'xx'     ,
                    'export_participations' => 'xx'     ,
                    'view_statistics' => 'xx'     ,
                    'export_statistics' => 'xx'     ,
                    'status' => $faker->randomElement(['Melton South','Melton West','Rye'])      ,
                    'clearing' => 'xx'     ,
                    'bon_number' => 'not disponible'      ,
                    'emission_quantity' =>'xx'      ,
                    'estimated_redemption' => 'xx'      ,
                    'redemption_to_date' => date('Ymd', strtotime("+2 day"))     ,
                    'dr_reference' => 'xx'      ,
                    'vat_rate' => 'xxx'   ,
                    'hon_reference' => 'xxx'      ,
                    'first_coupon_date' => date('Ymd', strtotime("-1 day"))      ,
                    'briefing_date' => date('Ymd', strtotime("+0 day"))      ,
                    'production_date' => date('Ymd', strtotime("+0 day"))     ,
                    'action_fed' => 'xx'     ,
                    'web_url' => $faker->url
                ]);

        }
    }
}

Please sign in or create an account to participate in this conversation.