Tri Tri - 4 months ago 33
PHP Question

Laravel: Error when run Seeder

I get an error when create a table seeder using model factory in laravel 5.3 but I don't know where I'm going wrong here.

Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, called in D:\Coding\php\laravel\simple-blog\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php on line 660 and defined

Here is my code:



namespace app;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
protected $table = 'articles';


Model Factory:

$factory->define(app\Article::class, function (Faker\Generator $faker){
return [
'title' => $faker->sentences(5),
'content' => $faker->text(),
'created_at' => \Carbon\Carbon::now(),
'updated_at' => \Carbon\Carbon::now()


public function up()
Schema::create('articles', function (Blueprint $table) {





use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Faker\Factory as Faker;
use app\Article as Article;

class ArticlesTableSeeder extends Seeder
* Run the database seeds.
* @return void
public function run()


'title' => $faker->sentences(5), produces array with 5 values. Make var before return and concat there these sentences.

Or sentences(5, true); Will produce 5 sentence text for you.