public function create($id, Request $request)
{
Laralum::permissionToAccess('laralum.posts.comments');
$post = Laralum::post('id', $id);
# Check blog permissions
Laralum::mustHaveBlog($post->blog->id);
# Check if comments are enabled
if ($post->logged_in_comments or $post->anonymous_comments) {
# create the user
$row = Laralum::newComment();
# Save the data
$data_index = 'comments';
require 'Data/Create/Save.php';
$row->post_id = $post->id;
if ($post->logged_in_comments) {
$row->user_id = Laralum::loggedInUser()->id;
}
$row->save();
return redirect()->route('Laralum::posts', ['id' => $post->id])->with('success', trans('laralum.msg_comment_created'));
} else {
abort(403, trans('laralum.msg_comment_disabled'));
}
}