Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app.js, Rename vue files to their names for auto importing #12

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'