Skip to content

Commit e5ed04a

Browse files
committed
Fix Errors
1 parent 871f259 commit e5ed04a

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

app/Models/User.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class User extends Authenticatable
2323
'name',
2424
'email',
2525
'password',
26-
'role'
26+
'role',
27+
'is_online'
2728
];
2829

2930
/**
@@ -48,4 +49,19 @@ protected function casts(): array
4849
'password' => 'hashed',
4950
];
5051
}
52+
public function chats(): \Illuminate\Database\Eloquent\Relations\HasMany
53+
{
54+
return $this->hasMany(Chat::class, 'user_id');
55+
}
56+
57+
public function agentChats(): \Illuminate\Database\Eloquent\Relations\HasMany
58+
{
59+
return $this->hasMany(Chat::class, 'agent_id');
60+
}
61+
62+
public function messages(): \Illuminate\Database\Eloquent\Relations\HasMany
63+
{
64+
return $this->hasMany(Message::class, 'sender_id');
65+
}
66+
5167
}

routes/api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
Route::prefix('user')->
4444
middleware('auth:sanctum')
4545
->group(function () {
46-
Route::get('/chats', [ChatController::class, 'getUserChats']);
46+
//Route::get('/chats', [ChatController::class, 'getUserChats']);
4747
Route::get('/profile', [AuthController::class, 'user']);
48-
Route::patch('/profile', [AuthController::class, 'updateProfile']);
48+
//Route::patch('/profile', [AuthController::class, 'updateProfile']);
4949
});
5050

5151
// Health Check Route

0 commit comments

Comments
 (0)