feat: add avatar and role fields to User model and update BlogSeeder for Zeynep Demir profile
This commit is contained in:
@@ -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']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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ü',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user