feat: add avatar and role fields to User model and update BlogSeeder for Zeynep Demir profile

This commit is contained in:
Ümit Tunç
2026-05-24 10:49:49 +03:00
parent 3ed63cacb3
commit 8c00956f29
3 changed files with 42 additions and 5 deletions
+2
View File
@@ -23,6 +23,8 @@ class User extends Authenticatable
'name',
'email',
'password',
'avatar',
'role',
];
/**
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('avatar')->nullable()->after('password');
$table->string('role')->nullable()->after('avatar');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['avatar', 'role']);
});
}
};
+14 -5
View File
@@ -15,12 +15,21 @@ class BlogSeeder extends Seeder
*/
public function run(): void
{
// 1. Author Bul veya Oluştur
$author = User::query()->first();
// 1. Kadın Yazar Bul veya Oluştur (Zeynep Demir)
$author = User::where('email', 'zeynep.demir@truncgil.com')->first();
if (!$author) {
$author = User::factory()->create([
'name' => 'Trunçgil Teknoloji',
'email' => 'info@truncgil.com',
$author = User::create([
'name' => 'Zeynep Demir',
'email' => 'zeynep.demir@truncgil.com',
'password' => bcrypt('password123'),
'avatar' => 'avatars/female_author.png',
'role' => 'Yapay Zeka ve Yazılım Editörü',
]);
} else {
$author->update([
'name' => 'Zeynep Demir',
'avatar' => 'avatars/female_author.png',
'role' => 'Yapay Zeka ve Yazılım Editörü',
]);
}