<?php

use App\Page;
use Faker\Factory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class PageDescriptionSeeder extends Seeder
{
     /**
     * The current Faker instance.
     *
     * @var \Faker\Generator
     */
    protected $faker;

    /**
     * Create a new seeder instance.
     *
     * @return void
     */
    public function __construct()
    { 
        $this->faker = Factory::create();
    }

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        foreach (Page::cursor() as $page){
            DB::table('page_descriptions')->insert([
                [
                    'title' => 'من نحن',
                    'slug' => 'من نحن',
                    'keywords' => 'من نحن',
                    'meta_description' => 'من نحن',
                    'description' => 'من نحن',
                    'page_id' => $page->id,
                    'language_id' => 1
                ],
                [
                    'title' => 'ABOUT US',
                    'slug' =>'ABOUT US',
                    'keywords' =>'ABOUT US',
                    'meta_description' =>'ABOUT US',
                    'description' => $this->faker->sentence(10),
                    'page_id' => $page->id,
                    'language_id' => 2
                ]
            ]);
        }
    }
}
