db:seed cleanup

This commit is contained in:
StudioTem committed 2023-01-24 21:54:03 +01:00
1 parent 33499107b7
commit dfac41f30a
9 files changed
+75 -18

No files matched your search

+24 -8
View File
@@ -3,9 +3,12 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Client;
use App\Models\MasterTask;
use App\Models\Project;
use App\Models\Team;
use App\Models\Timeblock;
use App\Models\Timesheet;
use App\Models\User;
use Illuminate\Database\Seeder;
@@ -18,25 +21,38 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
Client::factory()
->count(20)
->create();
Project::factory()
->hasClient()
->count(20)
->create();
for ($i=0; $i < 5; $i++) {
Team::factory()
->hasUsers(random_int(2, 5))
->create();
}
for ($i=0; $i < 3; $i++) {
for ($i=0; $i < 30; $i++) {
MasterTask::factory()
->hasAttachments(random_int(0, 3))
->hasSubTasks(random_int(3, 5))
->create();
}
// for ($i=0; $i < 3; $i++) {
// User::factory()
// ->hasSubTasks(3)
//// ->hasAttachments(random_int(0, 3))
//// ->hasSubTasks(random_int(3, 5))
// ->create();
// }
for ($i=0; $i < 30; $i++) {
Timeblock::factory()
->count(random_int(1, 2))
->create();
}
for ($i=0; $i < 30; $i++) {
Timesheet::factory()
->count(random_int(1, 2))
->create();
}
}
}