| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Events; |
| 4 |
|
| 5 |
use FluentCart\App\Models\ProductReview; |
| 6 |
|
| 7 |
class ReviewCreated extends EventDispatcher |
| 8 |
{ |
| 9 |
public string $hook = 'fluent_cart/review_created'; |
| 10 |
|
| 11 |
protected array $listeners = []; |
| 12 |
|
| 13 |
public ProductReview $review; |
| 14 |
|
| 15 |
public function __construct(ProductReview $review) |
| 16 |
{ |
| 17 |
$this->review = $review; |
| 18 |
} |
| 19 |
|
| 20 |
public function toArray(): array |
| 21 |
{ |
| 22 |
$this->review->load('product'); |
| 23 |
|
| 24 |
return [ |
| 25 |
'review' => $this->review, |
| 26 |
'product' => $this->review->product, |
| 27 |
]; |
| 28 |
} |
| 29 |
|
| 30 |
public function getActivityEventModel() |
| 31 |
{ |
| 32 |
return $this->review; |
| 33 |
} |
| 34 |
|
| 35 |
public function shouldCreateActivity(): bool |
| 36 |
{ |
| 37 |
return false; |
| 38 |
} |
| 39 |
} |
| 40 |
|