Update star route.

This commit is contained in:
Krzysztof Płaczek
2024-10-14 09:34:23 +02:00
parent f2e6cba2f5
commit 2b595c1403
4 changed files with 23 additions and 8 deletions

View File

@@ -0,0 +1,14 @@
<?php
namespace Krzysiej\RyobiCrawler\Controller;
use Krzysiej\RyobiCrawler\Models\Product;
final class StarController extends BaseController
{
public function __invoke(int $productId): void
{
Product::find($productId)->toggleStarred()->save();
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
}