Update star route.

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

No files matched your search

+14
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']);
}
}