Skip to content

Commit 1ba1c67

Browse files
Update pages factory and seeder (#29)
* Refactor image field and update PHP version requirements. Renamed the `image` field to `feature_image` in seeders and factories for improved clarity. Updated `composer.json` to drop support for PHP 8.1, ensuring compatibility with newer versions. * Update image field and add slug to fillable array Renamed `image` to `feature_image` for better clarity and added `slug` to the fillable attributes. Adjusted the `getDynamicSEOData` method to reflect these changes. This ensures alignment between database fields and application logic.
1 parent 14704c6 commit 1ba1c67

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.1||^8.2||^8.3||^8.4",
20+
"php": "^8.2||^8.3||^8.4",
2121
"spatie/laravel-package-tools": "^1.16",
2222
"spatie/laravel-google-fonts": ">=1.4.1",
2323
"ralphjsmit/laravel-seo": ">=1.6.7",

database/factories/PageFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function definition(): array
1616
'slug' => $this->faker->slug(),
1717
'title' => $this->faker->word(),
1818
'description' => $this->faker->text(),
19-
'image' => $this->faker->word(),
19+
'feature_image' => $this->faker->word(),
2020
'created_at' => Carbon::now(),
2121
'updated_at' => Carbon::now(),
2222
'registerMediaConversionsUsingModelInstance' => $this->faker->boolean(),

database/seeders/PageTableSeeder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function run(): void
1818
'slug' => 'home',
1919
'title' => 'home page',
2020
'description' => 'This is the home page description.',
21-
'image' => 'images/logo.png',
21+
'feature_image' => 'images/logo.png',
2222
],
2323

2424
];

src/Models/Page.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ class Page extends Model
1515

1616
protected $fillable = [
1717
'title',
18+
'slug',
1819
'description',
19-
'image',
20+
'feature_image',
2021
];
2122

2223
public function getDynamicSEOData(): SEOData
2324
{
2425
return new SEOData(
2526
title: ucwords($this->title),
2627
description: ucfirst($this->description),
27-
image: $this->image,
28+
image: $this->feature_image,
2829
);
2930
}
3031
}

0 commit comments

Comments
 (0)