You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/resources/views/segments/comments/SimpleComments/SimpleComments.php

28 lines
596 B
PHTML

<?php
namespace Resources\Views\Segments;
use App\Models\Part;
class SimpleComments
{
public static function onAdd(Part $part = null)
{
}
public static function onRemove(Part $part = null)
{
}
public static function onMount(Part $part = null, $model = null)
{
if ($model == null){
return $part;
}
$part->comments = $model->approvedComments()->whereNull('parent_id')->orderBy('id','desc')->get();
$part->commentable_type = get_class($model);
$part->commentable_id = $model->id;
return $part;
}
}