techblog/database/seeders/PostSeeder.php
PeterChrz 75561faf25
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
initialize project and update gitignore
2026-03-19 09:35:42 -04:00

70 lines
3.9 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\Category;
use App\Models\Post;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;
class PostSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$author = User::where('email', 'contact@techblog.com')->first();
if (!$author) {
return;
}
$posts = [
[
'title' => 'The Future of Cloud Computing in 2026',
'category' => 'Cloud Computing',
'excerpt' => 'Exploring the impact of edge computing, serverless architectures, and AI integration on the cloud landscape.',
'content' => "As we move into 2026, cloud computing continues to evolve at a breakneck pace. The boundaries between edge and cloud are blurring, with more processing power moving closer to the data source. Serverless architectures have matured, allowing developers to focus entirely on code rather than infrastructure.
AI integration is no longer a luxury but a core component of cloud services. From automated resource scaling to intelligent threat detection, AI is making cloud environments more efficient and secure. In this article, we'll dive deep into these trends and what they mean for the next generation of software development.",
],
[
'title' => 'Securing Your Home Network: A Comprehensive Guide',
'category' => 'Networking',
'excerpt' => 'Learn how to segment your network using VLANs and firewalls to protect your devices from external threats.',
'content' => "In an era where every household has dozens of connected devices, network security has never been more important. This guide covers the essentials of securing your home network, starting with the basics of firewall configuration and moving into more advanced topics like network segmentation.
We will explore how to use VLANs to isolate IoT devices from your primary network, preventing a compromised smart bulb from becoming a gateway to your personal computer. Additionally, we'll discuss the benefits of running a local DNS sinkhole like Pi-hole or AdGuard Home to block ads and trackers at the network level.",
],
[
'title' => 'Getting Started with Proxmox VE',
'category' => 'Virtualization',
'excerpt' => 'A step-by-step guide to installing and configuring Proxmox VE for your home lab environment.',
'content' => "Proxmox Virtual Environment is a complete open-source platform for enterprise virtualization. It tightly integrates KVM hypervisor and Linux Containers (LXC), software-defined storage, and networking functionality on a single platform.
For home lab enthusiasts, Proxmox offers a powerful yet accessible way to manage multiple virtual machines and containers. This post will walk you through the initial installation process, from creating a bootable USB to configuring your first bridge interface. We'll also cover some best practices for storage management and ZFS configuration to ensure your data remains safe and performant.",
],
];
foreach ($posts as $postData) {
$category = Category::where('name', $postData['category'])->first();
if ($category) {
Post::updateOrCreate(
['slug' => Str::slug($postData['title'])],
[
'title' => $postData['title'],
'content' => $postData['content'],
'excerpt' => $postData['excerpt'],
'status' => 'published',
'published_at' => now(),
'author_id' => $author->id,
'category_id' => $category->id,
]
);
}
}
}
}