50% Off/-

50% Off/-

Php

50% Off/-

50% Off/-

Web

50% Off/-

50% Off/-

Laravel Seeding in Detail

17-08-2017

Associate User with same role:

 factory(\App\Models\User::class, 'random', 50)->create()->each(function ($u, $value) {
            if ($value == null)
                $value = factory(App\Models\Role::class, 'satici')->make();
            else
                $value = \App\Models\Role::where(['name'=>'satici'])->firstOrFail();
            $u->roles()->save($value);
        });

© 2019 Tüm Hakları Saklıdır. Codesenior.COM