<?php

use Illuminate\Database\Seeder;

class ContentSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $values = [1, 3, 4];
        foreach ($values as $value) {
            $item = \App\Models\Content::where('type', $value)->first();
            if(!empty($item)) {
                for ($i = 0; $i < 20; ++$i) {
                    \App\Models\Content::create([
                        'type' => $value,
                        'title' => $item->title,
                        'pic_url' => $item->pic_url,
                        'content' => $item->content,
                        'sort' => $item->sort
                    ]);
                }
            }
        }
    }
}
