Want to access all of our courses? (36 h 00 min)
You also get:
Already a member? Login here
User::factory(50)->vendor()->has($restaurants)->create();
in this code where you define vendor ? when i am running the seedor getting error of this kindly guide me thanks,
Muhammad Zaryab
kindly add the state of vendor in userfactory.php
public function vendor(): static { return $this->afterCreating(function (User $user) { $vendorRole = Role::where('name', RoleName::VENDOR->value)->first(); $user->roles()->sync($vendorRole); }); }
User::factory(50)->vendor()->has($restaurants)->create();
in this code where you define vendor ? when i am running the seedor getting error of this kindly guide me thanks,
Muhammad Zaryab
kindly add the state of vendor in userfactory.php
public function vendor(): static { return $this->afterCreating(function (User $user) { $vendorRole = Role::where('name', RoleName::VENDOR->value)->first(); $user->roles()->sync($vendorRole); }); }