Skip to content

Commit

Permalink
Add package.js (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Apr 5, 2023
1 parent 8d3ee51 commit d0828bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@

## Installation

```
```bash
composer require rapidez/reviews
```

And register the Vue components in `resources/js/app.js`:
```
Vue.component('stars', require('Vendor/rapidez/reviews/resources/js/components/Stars.vue').default)
Vue.component('star-input', require('Vendor/rapidez/reviews/resources/js/components/StarInput.vue').default)
```

If you haven't published the Rapidez views yet, publish them with:
```
```bash
php artisan vendor:publish --provider="Rapidez\Core\RapidezServiceProvider" --tag=views
```

Expand All @@ -28,7 +22,7 @@ If you'd like to show product reviews on out-of-stock product pages you need to
#### Review stars

Add the stars where you'd like in `resources/views/vendor/rapidez/product/overview.blade.php`:
```
```blade
@if($product->reviews_score)
<stars :score="{{ $product->reviews_score }}" :count="{{ $product->reviews_count }}"></stars>
@endif
Expand All @@ -39,7 +33,7 @@ Add the stars where you'd like in `resources/views/vendor/rapidez/product/overvi
#### Review list

The review list can be added with:
```
```blade
@include('rapidez-reviews::reviews', [
'sku' => $product->sku,
'reviews_count' => $product->reviews_count,
Expand All @@ -50,7 +44,7 @@ The review list can be added with:
#### Review form

And the form to add a review:
```
```blade
@include('rapidez-reviews::form', ['sku' => $product->sku])
```

Expand All @@ -59,14 +53,14 @@ And the form to add a review:
#### Review stars

Add somewhere in `resources/views/category/partials/listing/item.blade.php`:
```
```blade
<stars v-if="item.reviews_score" :score="item.reviews_score" :count="item.reviews_count"></stars>
```

## Views

If you need to change the views you can publish them with:
```
```bash
php artisan vendor:publish --provider="Rapidez\Reviews\ReviewsServiceProvider" --tag=views
```

Expand Down
4 changes: 4 additions & 0 deletions resources/js/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import 'Vendor/rapidez/core/resources/js/vue'

Vue.component('star-input', () => import('./components/StarInput.vue'))
Vue.component('stars', () => import('./components/Stars.vue'))
1 change: 1 addition & 0 deletions resources/js/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './components'

0 comments on commit d0828bb

Please sign in to comment.