Installation | laravel-comments | Spatie

 SPATIE

laravel-comments
================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-comments](https://spatie.be/docs/laravel-comments/v2)  Livewire-components  Installation

 Version   v2   v1

 Other versions for crawler [v2](https://spatie.be/docs/laravel-comments/v2) [v1](https://spatie.be/docs/laravel-comments/v1)

- [ Introduction ](https://spatie.be/docs/laravel-comments/v2/introduction)
- [ Getting a license ](https://spatie.be/docs/laravel-comments/v2/getting-a-license)
- [ Requirements ](https://spatie.be/docs/laravel-comments/v2/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-comments/v2/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-comments/v2/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-comments/v2/changelog)
- [ Upgrade guide ](https://spatie.be/docs/laravel-comments/v2/upgrade)
- [ About us ](https://spatie.be/docs/laravel-comments/v2/about-us)

Basic usage
-----------

- [ Working with comments ](https://spatie.be/docs/laravel-comments/v2/basic-usage/working-with-comments)
- [ Working with reactions ](https://spatie.be/docs/laravel-comments/v2/basic-usage/working-with-reactions)
- [ Transforming comments ](https://spatie.be/docs/laravel-comments/v2/basic-usage/transforming-comments)
- [ Sending notifications ](https://spatie.be/docs/laravel-comments/v2/basic-usage/sending-notifications)
- [ Approving comments ](https://spatie.be/docs/laravel-comments/v2/basic-usage/approving-comments)
- [ Listing comments in Laravel Nova ](https://spatie.be/docs/laravel-comments/v2/basic-usage/listing-comments-in-laravel-nova)

Livewire components
-------------------

- [ Introduction ](https://spatie.be/docs/laravel-comments/v2/livewire-components/introduction)
- [ Installation ](https://spatie.be/docs/laravel-comments/v2/livewire-components/installation)
- [ Using the components ](https://spatie.be/docs/laravel-comments/v2/livewire-components/using-the-components)
- [ Taking care of authorization ](https://spatie.be/docs/laravel-comments/v2/livewire-components/taking-care-of-authorization)
- [ Customising the views ](https://spatie.be/docs/laravel-comments/v2/livewire-components/customising-the-views)
- [ Mentions ](https://spatie.be/docs/laravel-comments/v2/livewire-components/mentions)
- [ Miscellaneous options ](https://spatie.be/docs/laravel-comments/v2/livewire-components/miscellaneous-options)
- [ Using Markdown ](https://spatie.be/docs/laravel-comments/v2/livewire-components/using-markdown)

 Installation
============

###  On this page

1. [ Using the assets ](#content-using-the-assets)
2. [ Troubleshooting ](#content-troubleshooting)

To use the Livewire components provided by this package, you must first install [Livewire](https://laravel-livewire.com) itself. Make sure you follow [their installation instructions](https://laravel-livewire.com/docs/2.x/installation).

After that, you should follow [the installation instructions](https://spatie.be/docs/laravel-comments/v1/laravel-comments) of the base spatie/laravel-comments package. After following these instructions, you should have migrated your database and prepared your model.

With that all done, you're ready to pull in the `spatie/laravel-comments-livewire` package

```
composer require spatie/laravel-comments-livewire
```

Using the assets
--------------------------------------------------------------------------------------------------------

On each page where you want to use the components, you should include the styles and scripts provided by the package by using one of the following methods.

### Method 1: using the blade directives

You can include the styles in the head of your page.

```

    @laravelCommentsLivewireStyles

```

You can include the scripts before the closing body tag.

```

    @laravelCommentsLivewireScripts

```

### Method 2: Bundling the assets in your app

While method 1 is an easy way of getting started you might prefer to bundle the assets in your app.

In your `app.css` file you can import the styles.

```
@import '../../vendor/spatie/laravel-comments-livewire/resources/dist/comments.css';
```

And in your `app.js` you can do the same for the scripts.

```
import '../../vendor/spatie/laravel-comments-livewire/resources/dist/comments.js';
```

Troubleshooting
-----------------------------------------------------------------------------------------------------

If you want problems installing the package, take a look at [our demo app](https://github.com/spatie/laravel-comments-app) and compare it against yours.
