Files
Faculty-Documentation/database/seeders/PatentsTableSeeder.php
2025-04-27 15:42:42 +05:30

63 lines
2.0 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Patent;
use Carbon\Carbon;
class PatentsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$titles = [
'Smart Irrigation System',
'AI-Based Traffic Control',
'Wearable Health Monitoring Device',
'Solar-Powered Water Purifier',
'Autonomous Drone Navigation System',
'Blockchain-based Voting System',
'Biodegradable Packaging Material'
];
$investigators = [
'Dr. Anjali Verma',
'Prof. Ravi Kumar',
'Dr. Meera Iyer',
'Dr. Arjun Singh',
'Prof. Sneha Shah',
'Dr. Vikrant Joshi'
];
$types = ['Provisional', 'Complete', 'Design', 'Innovation Patent'];
$statuses = ['Filed', 'Published', 'Granted', 'Rejected'];
// Number of records to seed
$numberOfRecords = 10;
for ($i = 1; $i <= $numberOfRecords; $i++) {
// Random submission and filling dates
$submissionDate = Carbon::now()->subYears(rand(1, 5))->subMonths(rand(0, 11))->subDays(rand(0, 29));
$fillingDate = (clone $submissionDate)->addDays(rand(1, 60));
Patent::create([
'faculty_id' => rand(1, 5),
'department_id' => rand(1, 5),
'title' => $titles[array_rand($titles)],
'investigator' => $investigators[array_rand($investigators)],
'application_no' => 'APP' . rand(100000, 999999), // Random Application No
'type' => $types[array_rand($types)],
'date_of_submission' => $submissionDate->format('Y-m-d'),
'date_of_filling' => $fillingDate->format('Y-m-d'),
'status' => $statuses[array_rand($statuses)],
'proof' => null, // No proof uploaded
]);
}
}
}