mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 14:09:43 -08:00
Remove hard-coded manager_id in factory
This commit is contained in:
parent
7062b0acaa
commit
76861c0c30
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use \Auth;
|
use \Auth;
|
||||||
|
|
||||||
|
@ -79,7 +80,9 @@ class UserFactory extends Factory
|
||||||
return $this->state(function () {
|
return $this->state(function () {
|
||||||
return [
|
return [
|
||||||
'permissions' => '{"admin":"1"}',
|
'permissions' => '{"admin":"1"}',
|
||||||
'manager_id' => rand(1, 2),
|
'manager_id' => function () {
|
||||||
|
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
||||||
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue