Skip to content

Commit cbaefa3

Browse files
author
Gareth Redfern
committed
refactor Message column name from ‘message’ to ‘body’
1 parent 6bac3a8 commit cbaefa3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/Http/Resources/MessageResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function toArray($request)
1717
{
1818
return [
1919
'id' => $this->id,
20-
'message' => $this->message,
20+
'body' => $this->body,
2121
'user' => new UserBasicResource($this->user),
2222
'createdAt' => $this->created_at->diffForHumans(),
2323
'timestamp' => $this->created_at->unix(),

app/Models/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Message extends Model
1515
* @var array
1616
*/
1717
protected $fillable = [
18-
'message',
18+
'body',
1919
];
2020

2121
public function user()

database/migrations/2021_01_22_220306_create_messages_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function up()
1616
Schema::create('messages', function (Blueprint $table) {
1717
$table->id();
1818
$table->foreignId('user_id')->constrained()->onDelete('cascade');
19-
$table->text('message');
19+
$table->text('body');
2020
$table->timestamps();
2121
});
2222
}

0 commit comments

Comments
 (0)