185 خطوط
8.5 KiB
PHP
185 خطوط
8.5 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use Illuminate\Database\Seeder;
|
||
use Illuminate\Support\Facades\DB;
|
||
|
||
class ActivityLogSeeder extends Seeder
|
||
{
|
||
public function run(): void
|
||
{
|
||
$users = DB::table('users')->pluck('id', 'email');
|
||
$now = now();
|
||
|
||
$activities = [
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'پروژه "سامانه مدیریت منابع انسانی" ایجاد شد',
|
||
'subject_type' => 'App\Models\Project',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(720),
|
||
'updated_at' => $now->copy()->subHours(720),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'وظیفه "طراحی و پیادهسازی ماژول حضور و غیاب" ایجاد شد',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(700),
|
||
'updated_at' => $now->copy()->subHours(700),
|
||
],
|
||
[
|
||
'user_id' => $users['member@pm.com'],
|
||
'action' => 'updated',
|
||
'description' => 'وضعیت وظیفه "طراحی و پیادهسازی ماژول حضور و غیاب" به در حال انجام تغییر کرد',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(650),
|
||
'updated_at' => $now->copy()->subHours(650),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'assigned',
|
||
'description' => 'وظیفه "مدیریت درخواستهای مرخصی" به مریم حسینی تخصیص یافت',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 4,
|
||
'created_at' => $now->copy()->subHours(500),
|
||
'updated_at' => $now->copy()->subHours(500),
|
||
],
|
||
[
|
||
'user_id' => $users['observer@pm.com'],
|
||
'action' => 'completed',
|
||
'description' => 'وظیفه "مدیریت درخواستهای مرخصی" تکمیل شد',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 4,
|
||
'created_at' => $now->copy()->subHours(300),
|
||
'updated_at' => $now->copy()->subHours(300),
|
||
],
|
||
[
|
||
'user_id' => $users['member@pm.com'],
|
||
'action' => 'commented',
|
||
'description' => 'نظری بر وظیفه "طراحی و پیادهسازی ماژول حضور و غیاب" اضافه کرد',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(200),
|
||
'updated_at' => $now->copy()->subHours(200),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'پروژه "اپلیکیشن موبایل فروشگاهی" ایجاد شد',
|
||
'subject_type' => 'App\Models\Project',
|
||
'subject_id' => 2,
|
||
'created_at' => $now->copy()->subHours(400),
|
||
'updated_at' => $now->copy()->subHours(400),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'اسپرینت ۱ برای پروژه "سامانه مدیریت منابع انسانی" ایجاد شد',
|
||
'subject_type' => 'App\Models\Sprint',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(600),
|
||
'updated_at' => $now->copy()->subHours(600),
|
||
],
|
||
[
|
||
'user_id' => $users['admin@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'نقش "مدیر پروژه" به سارا احمدی تخصیص یافت',
|
||
'subject_type' => 'App\Models\Role',
|
||
'subject_id' => 2,
|
||
'created_at' => $now->copy()->subHours(800),
|
||
'updated_at' => $now->copy()->subHours(800),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'مورد بکلاگ "اضافه کردن قابلیت ثبت اثرانگشت" ایجاد شد',
|
||
'subject_type' => 'App\Models\BacklogItem',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(150),
|
||
'updated_at' => $now->copy()->subHours(150),
|
||
],
|
||
[
|
||
'user_id' => $users['ceo@pm.com'],
|
||
'action' => 'viewed',
|
||
'description' => 'گزارش پیشرفت پروژه "سامانه مدیریت منابع انسانی" مشاهده شد',
|
||
'subject_type' => 'App\Models\Report',
|
||
'subject_id' => null,
|
||
'created_at' => $now->copy()->subHours(48),
|
||
'updated_at' => $now->copy()->subHours(48),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'updated',
|
||
'description' => 'اولویت پروژه "اپلیکیشن موبایل فروشگاهی" به فوری تغییر کرد',
|
||
'subject_type' => 'App\Models\Project',
|
||
'subject_id' => 2,
|
||
'created_at' => $now->copy()->subHours(120),
|
||
'updated_at' => $now->copy()->subHours(120),
|
||
],
|
||
[
|
||
'user_id' => $users['member@pm.com'],
|
||
'action' => 'uploaded',
|
||
'description' => 'فایل "مستندات API ورژن ۲" بارگذاری شد',
|
||
'subject_type' => 'App\Models\File',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(24),
|
||
'updated_at' => $now->copy()->subHours(24),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'جلسه "برنامهریزی اسپرینت ۲" برنامهریزی شد',
|
||
'subject_type' => 'App\Models\Meeting',
|
||
'subject_id' => 1,
|
||
'created_at' => $now->copy()->subHours(72),
|
||
'updated_at' => $now->copy()->subHours(72),
|
||
],
|
||
[
|
||
'user_id' => $users['observer@pm.com'],
|
||
'action' => 'reported',
|
||
'description' => 'اشکال "محاسبه اضافه کار" در بکلاگ ثبت شد',
|
||
'subject_type' => 'App\Models\BacklogItem',
|
||
'subject_id' => 2,
|
||
'created_at' => $now->copy()->subHours(36),
|
||
'updated_at' => $now->copy()->subHours(36),
|
||
],
|
||
[
|
||
'user_id' => $users['admin@pm.com'],
|
||
'action' => 'updated',
|
||
'description' => 'تنظیمات سیستم بهروزرسانی شد',
|
||
'subject_type' => 'App\Models\Setting',
|
||
'subject_id' => null,
|
||
'created_at' => $now->copy()->subHours(12),
|
||
'updated_at' => $now->copy()->subHours(12),
|
||
],
|
||
[
|
||
'user_id' => $users['manager@pm.com'],
|
||
'action' => 'created',
|
||
'description' => 'پروژه "بازطراحی وبسایت شرکتی" ایجاد شد',
|
||
'subject_type' => 'App\Models\Project',
|
||
'subject_id' => 3,
|
||
'created_at' => $now->copy()->subHours(96),
|
||
'updated_at' => $now->copy()->subHours(96),
|
||
],
|
||
[
|
||
'user_id' => $users['member@pm.com'],
|
||
'action' => 'updated',
|
||
'description' => 'وضعیت وظیفه "طراحی صفحه اصلی اپلیکیشن" به در حال انجام تغییر کرد',
|
||
'subject_type' => 'App\Models\Task',
|
||
'subject_id' => 9,
|
||
'created_at' => $now->copy()->subHours(50),
|
||
'updated_at' => $now->copy()->subHours(50),
|
||
],
|
||
];
|
||
|
||
foreach ($activities as $activity) {
|
||
DB::table('activity_logs')->insert($activity);
|
||
}
|
||
}
|
||
}
|