Update star route.
This commit is contained in:
14
src/Controller/StarController.php
Normal file
14
src/Controller/StarController.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user