1. Go to this page and download the library: Download alfasix/alfakit-comments library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use AlfaSix\AlfakitComments\Concerns\HasComments;
use AlfaSix\AlfakitComments\Concerns\IsCommenter;
use AlfaSix\AlfakitComments\Contracts\Commentable;
use AlfaSix\AlfakitComments\Contracts\Commenter;
class Ticket extends Model implements Commentable
{
use HasComments;
}
class User extends Authenticatable implements Commenter
{
use IsCommenter;
}
use AlfaSix\AlfakitComments\Actions\CommentsAction;
use AlfaSix\AlfakitComments\Actions\CommentsTableAction;
use AlfaSix\AlfakitComments\Infolists\Components\CommentsEntry;
use AlfaSix\AlfakitComments\Widgets\CommentsWidget;
// Infolist (view page), or a form (edit page)
Section::make('Comments')->schema([CommentsEntry::make()]);
// Header action: the comments in a slide-over
CommentsAction::make();
// Table row action
$table->recordActions([CommentsTableAction::make()]);
// A polling feed in a record page's footer widgets
protected function getFooterWidgets(): array
{
return [CommentsWidget::class];
}
// From code
$ticket->comment('<p>Done!</p>', $user);