<?php

use Illuminate\Database\Seeder;
use \App\PaymentType;

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

        DB::table("payment_types")->insert([
            [
                "name" => "credit card",
                "slug" => "stripe",
                "description" => "payment with credit card",
                "active" => true,
                "auto" => true
            ],
            [
                "name" => "cash",
                "slug" => "cash",
                "description" => "payment on box, with cash",
                "active" => true,
                "auto" => false
            ],
            [
                "name" => "PayPal",
                "slug" => "paypal",
                "description" => "payment with PayPal",
                "active" => false,
                "auto" => true
            ],
        ]);

        foreach (PaymentType::all() as $pt){
            $pt->payment()->saveMany(factory(App\Payment::class, 2)->make());
        }
    }
}
