2021-07-25 22:54:15 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Application;
|
|
|
|
use App\Comment;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
|
|
class CommentService
|
|
|
|
{
|
2023-01-15 00:04:00 +00:00
|
|
|
public function addComment(Application $application, $comment): Comment
|
|
|
|
{
|
2021-07-25 22:54:15 +01:00
|
|
|
return Comment::create([
|
|
|
|
'authorID' => Auth::user()->id,
|
|
|
|
'applicationID' => $application->id,
|
|
|
|
'text' => $comment,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function deleteComment(Comment $comment): ?bool
|
|
|
|
{
|
|
|
|
return $comment->delete();
|
|
|
|
}
|
|
|
|
}
|