Skip to content
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

Merged
merged 8 commits into from
Nov 8, 2023
Merged

init comment system #7

merged 8 commits into from
Nov 8, 2023

Conversation

tabuna
Copy link
Member

@tabuna tabuna commented Nov 7, 2023

Добавлена простая система комментариев с возможностью подключать не только статьи.

Нужно добавить:

  • что бы вместо логики в blade шаблоне, эта логика была во фрейме. (И лениво подгружаться, я не могу сказать, что тут финальный вариант)
  • редактирование/ответ так же подгружались динамически во фрейме (Возможно сделать через summary тег, что бы было как можно проще)
  • Удалённый комментарий, должен отображаться. Например: "Тут что-то было, но удалилось"
  • Ограничить, css отступ (В будущем)

@tabuna tabuna requested a review from agoalofalife November 7, 2023 01:33
@tabuna
Copy link
Member Author

tabuna commented Nov 7, 2023

Линтеры и Action не доступны, потому что репозиторий закрытый

@agoalofalife
Copy link
Member

Я пока добавил просто локально psr для себя, но мы можем настроить Pint

public function store(Request $request)
{
$request->validate([
'commentable_type' => 'required|sometimes|string',
Copy link
Member

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([
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я конечно такую магию не особо люблю, тут комментариями хотя бы примеры добавить что может содержать

*
* @return string
*/
protected function urlsToLink(string $text = null): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы переименовал в urlFromTextToHtmlUrl

*
* @return string
*/
protected function mentionsToLink(string $text = null): string
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Будем хранить эти комментарии?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, для всей цепочки. Посмотрим на сколько это будет востребовано. Как вариант будем удалять если нет дочерних элементов

@tabuna tabuna merged commit 6e1fca4 into master Nov 8, 2023
@tabuna tabuna deleted the comments branch November 8, 2023 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants