• Czas czytania ~1 min
  • 05.06.2022

Komentarze Laravel to pakiet komentarzy premium dla aplikacji korzystających z PHP 8.1+ i Laravel 9+ firmy Spatie. Za pomocą tego pakietu możesz tworzyć i kojarzyć komentarze z modelami Eloquent.

W momencie premiery główne funkcje Laravel Comments obejmują:

  • A beautiful Livewire component to display comments
  • markdown submission is supported, we'll render it as html
  • code snippets that appear in comments will automatically be highlighted
  • users can react to comments (👍, ❤️, or any emoji you want)
  • optionally, you enable a comment approval flow
  • sane API for creating your own commenting UI
  • Livewire components out of the box

Sednem tego pakietu jest cecha HasComments, którą dodasz do modeli:

use Illuminate\Database\Eloquent\Model;
use Spatie\Comments\Models\Concerns\HasComments;
 
class Post extends Model
{
    use HasComments;
}

Co z kolei umożliwia zarządzanie komentarzami i reakcjami na model:

$post->comment("I've got a feeling");
 
$comment->react('😍');

Chociaż powyższy przykład jest prostym przykładem, pakiet zawiera również w pełni upieczony komponent Laravel Livewire, który obsługuje również jeden poziomnzagnieżdżone komentarze:

Pamiętaj, że aby korzystać z tego pakietu, musisz zapłacić za licencję premium. Aby rozpocząć, zapoznaj się z dokumentacją Laravel Comments.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

O

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

O autorze CrazyBoy49z
WORK EXPERIENCE
Kontakt
Ukraine, Lutsk
+380979856297