larasell-dev / reviews
Product reviews for Larasell
Requires
- php: ^8.3
- larasell-dev/admin: ^0.5.5
- larasell-dev/chronicle: ^0.2.7
- larasell-dev/larasell: ^1.18
- laravel/framework: ^13.23
- spatie/laravel-data: ^4.23
Requires (Dev)
- larasell-dev/phpstan-rules: ^0.1
- larastan/larastan: ^3.0
- laravel/pint: ^1.32
- laravel/wayfinder: dev-next
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.7
- pestphp/pest-plugin-laravel: ^4.1
- spatie/laravel-typescript-transformer: ^2.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-01 10:14:49 UTC
README
Product reviews for Larasell.
Installation
composer require larasell-dev/reviews php artisan migrate php artisan larasell:link
The admin panel gets a Reviews page below Products. It lists every review with its status (pending, approved or rejected) and lets admins approve or reject each one. Each row opens the review on its own page.
Usage
use Larasell\Reviews\Actions\SubmitProductReview; // A guest review; the name is required. app(SubmitProductReview::class)->handle($product, rating: 5, name: 'Alex', comment: 'Great lamp.'); // A customer's review copies their name, so it stays when the customer is deleted. app(SubmitProductReview::class)->handle($product, rating: 4, customer: $customer);
New reviews are pending. ApproveProductReview and RejectProductReview change their status.
API
A JSON:API 1.1 API under /api/product-reviews lists, shows, creates, updates (PATCH) and
deletes reviews. Every request needs an API token, which an admin creates under
Settings > API tokens, sent as Authorization: Bearer <token>; without one it answers 401.
openapi.yaml describes it; open it in Yaak, Swagger UI or Redoc.
Events
| Event | When |
|---|---|
ProductReviewSubmitted |
A review is submitted. |
ProductReviewApproved |
A review is approved. |
ProductReviewRejected |
A review is rejected. |
ProductReviewUpdated |
A review's rating, name or comment changes. |
ProductReviewDeleted |
A review is deleted. |
All live in Larasell\Reviews\Events, carry the $review, and dispatch after the transaction commits.
Development
composer test # Pest composer phpstan # Larastan composer lint # Pint npm run commitlint # Commitlint on the last commit npm run typecheck # TypeScript npm run build # The admin assets, into public/vendor/larasell-reviews npm run dev # The admin assets with live reloading
Admin pages are React components registered with Larasell.booting() in resources/js/admin.ts.
npm run build bundles them with the panel's larasell() Vite plugin. The panel loads them through
AdminPanel::vite(), and larasell:link links the bundle into the app.
Breaking changes get an upgrade note in breaking-changes/ and a ! in the pull request title, e.g.
feat!: ...; see breaking-changes/AGENT.md. CI checks that both go together.
The build isn't committed on main. The release workflow builds it on release-please's release
branch, so each release tag ships it, and CI rejects other pull requests that change it.
The playground serves the admin panel with sample reviews (vendor/bin/testbench serve);
.agents/setup prepares it.