-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init comment system #7
Conversation
Линтеры и Action не доступны, потому что репозиторий закрытый |
Я пока добавил просто локально psr для себя, но мы можем настроить Pint |
public function store(Request $request) | ||
{ | ||
$request->validate([ | ||
'commentable_type' => 'required|sometimes|string', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я предпочитаю везде массив для единообразия, потому что часто, надо Rule или кастом добавлять, что думаете?
*/ | ||
public function store(Request $request) | ||
{ | ||
$request->validate([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В Form Request?
'message' => 'required|string', | ||
]); | ||
|
||
$model = $request->commentable_type::findOrFail($request->commentable_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я конечно такую магию не особо люблю, тут комментариями хотя бы примеры добавить что может содержать
app/Models/Comment.php
Outdated
* | ||
* @return string | ||
*/ | ||
protected function urlsToLink(string $text = null): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы переименовал в urlFromTextToHtmlUrl
app/Models/Comment.php
Outdated
* | ||
* @return string | ||
*/ | ||
protected function mentionsToLink(string $text = null): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mentionedUserToHtmlUrl
* | ||
* @return \Illuminate\Contracts\View\View | ||
*/ | ||
public function frameForArticles(Post $post) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:View
* | ||
* @return \App\Models\Comment | ||
*/ | ||
public function reply(Request $request, Comment $comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:Comment
* | ||
* @return \App\Models\Comment | ||
*/ | ||
public function update(Request $request, Comment $comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:Comment
@@ -16,6 +16,8 @@ class PostController extends Controller | |||
*/ | |||
public function show(Post $post) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:View
|
||
class Comment extends Model | ||
{ | ||
use HasFactory, SoftDeletes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Будем хранить эти комментарии?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, для всей цепочки. Посмотрим на сколько это будет востребовано. Как вариант будем удалять если нет дочерних элементов
Добавлена простая система комментариев с возможностью подключать не только статьи.
Нужно добавить:
Ограничить, css отступ (В будущем)