Skip to main content

Public Homepage and Restaurant Page

Premium
11 min read
Zaryab Rizvi avatar

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

Zaryab Rizvi avatar

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); }); }