71 lines
2.0 KiB
PHP
71 lines
2.0 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Database\Seeders;
|
||
|
|
|
||
|
|
use App\Models\Category;
|
||
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||
|
|
use Illuminate\Database\Seeder;
|
||
|
|
use Illuminate\Support\Str;
|
||
|
|
|
||
|
|
class CategorySeeder extends Seeder
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Run the database seeds.
|
||
|
|
*/
|
||
|
|
public function run(): void
|
||
|
|
{
|
||
|
|
$categories = [
|
||
|
|
[
|
||
|
|
'name' => 'Developer Tools',
|
||
|
|
'description' => 'Tools and services for developers',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Productivity',
|
||
|
|
'description' => 'Apps and tools to boost productivity',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Design',
|
||
|
|
'description' => 'Design tools and resources',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Marketing',
|
||
|
|
'description' => 'Marketing tools and platforms',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'AI & Machine Learning',
|
||
|
|
'description' => 'AI-powered tools and services',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Analytics',
|
||
|
|
'description' => 'Data analytics and tracking tools',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Communication',
|
||
|
|
'description' => 'Communication and collaboration tools',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'E-commerce',
|
||
|
|
'description' => 'E-commerce platforms and tools',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Education',
|
||
|
|
'description' => 'Educational tools and platforms',
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'name' => 'Finance',
|
||
|
|
'description' => 'Financial services and tools',
|
||
|
|
],
|
||
|
|
];
|
||
|
|
|
||
|
|
foreach ($categories as $category) {
|
||
|
|
Category::create([
|
||
|
|
'name' => $category['name'],
|
||
|
|
'slug' => Str::slug($category['name']),
|
||
|
|
'description' => $category['description'],
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
$this->command->info('Categories created successfully!');
|
||
|
|
}
|
||
|
|
}
|