mardi 1 septembre 2015

Laravel passing variables from one seed file to another?

I have created multiple seed files and my main DatabaseSeeder file looks like this:

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $name1 = "James";
        $name2 = "Jeff";
        $name3 = "Joe";

        $this->call(UserTableSeeder::class);
        $this->call(PersonTableSeeder::class);
        $this->call(IndividualTableSeeder::class);
        $this->call(HumanTableSeeder::class);
    }
}

How can I make it so that UserTableSeeder and PersonTableSeeder gets the variables from my main seeder file? (What i'm really trying to do is use Faker to output random values, but use the same value for each table seeder)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UlkD8v
via IFTTT

Aucun commentaire:

Enregistrer un commentaire