php - ErrorException array to string conversion on migrate --seed -


i'm trying set first laravel project when try have artisan seed database faker throws

[errorexception] array string conversion

i'm working stock users migration file , using command php artisan migrate --seed

any guidance appreciated

use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration;  class createuserstable extends migration { /**  * run migrations.  *  * @return void  */ public function up() {     schema::create('users', function (blueprint $table) {         $table->increments('id');         $table->string('name');         $table->string('email')->unique();         $table->string('password', 60);         $table->string('role', array('user', 'admin', 'superuser'));         $table->remembertoken();         $table->timestamps();     }); }  /**  * reverse migrations.  *  * @return void  */ public function down() {     schema::drop('users'); } } 

and usertableseeder artisan generated me

use illuminate\database\seeder;  class usertableseeder extends seeder { /**  * run database seeds.  *  * @return void  */ public function run() {     factory(app\user::class, 49)->create();     factory(app\user::class)->create([         'name' => 'admin',         'role' => 'admin',     ]); } } 

this modelfactory.php

$factory->define(app\user::class, function ($faker) { return [     'name' => $faker->name,     'email' => $faker->email,     'password' => str_random(10),     'remember_token' => str_random(10),     'role' => $faker->word->randomelement(array('user','superuser')), ]; }); 

$table->string('role', array('user', 'admin', 'superuser'));

you selecting type of string , providing array.

this error talking about.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -