same at 22.05.2023

This commit is contained in:
Anatoliy Poloz
2023-05-22 09:52:08 +00:00
parent a9601ab15d
commit 1e546fa48e
216 changed files with 246857 additions and 6014 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Livewire\BlogPost\Comment;
use Livewire\Component;
use App\Models\BlogPost;
use App\Models\BlogPostComment;
use App\Models\User;
class Create extends Component
{
public BlogPost $blogPost;
public User $user;
public $body = '';
public $grade = 0;
public function render()
{
return view('livewire.blog-post.comment.create');
}
public function save()
{
$comment = new BlogPostComment();
$comment->grade = $this->grade;
$comment->body = $this->body;
$comment->blog_post_id = $this->blogPost->id;
$comment->user_id = $this->user->id;
$comment->save();
$this->reset(['body', 'grade']);
$this->emitTo('blog-post.comment.show', 'commentAdded');
}
}