Files
pricebuddy/app/Http/Resources/StoreResource.php
Jeremy d1a8f1d009 feat: product insights tab
Add a Product Insights tab backed by a suite of price-analysis calculators and a
redesigned price history chart.

- Insights calculators: listing-history and daily best-price series builders,
  price stats, percentile, deal score, distribution, drop events, store showdown,
  seasonality, availability timeline, and target tracker
- ProductInsights aggregator service composing the calculators
- Price history chart: best-price and target datasets, best-price line honours the
  unit/retail filter, horizontal scroll on mobile
- Rename the History tab to Insights with consistent heading styling
- Feature and unit test coverage, plus review-feedback fixes
2026-06-18 23:13:14 +10:00

34 lines
959 B
PHP

<?php
namespace App\Http\Resources;
use App\Models\Store;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @property Store $resource
*/
class StoreResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->resource->getKey(),
'name' => $this->resource->name,
'slug' => $this->resource->slug,
'initials' => $this->resource->initials,
'domains' => $this->resource->domains,
// Exposed as `scrape_settings` in the API; the model attribute is `scrape_strategy`.
// The name differs intentionally to keep the public contract stable.
'scrape_settings' => $this->resource->scrape_strategy,
'settings' => $this->resource->settings,
];
}
}