FleetCart/Modules/Currency/Http/Controllers/CurrentCurrencyController.php

27 lines
542 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Currency\Http\Controllers;
2023-12-03 14:07:47 +00:00
use Illuminate\Http\Response;
2023-06-11 12:14:03 +00:00
class CurrentCurrencyController
{
/**
* Store a newly created resource in storage.
*
* @param string $currency
2023-12-03 14:07:47 +00:00
*
* @return Response
2023-06-11 12:14:03 +00:00
*/
public function store($currency)
{
2023-12-03 14:07:47 +00:00
if (!in_array($currency, setting('supported_currencies'))) {
2023-06-11 12:14:03 +00:00
return back();
}
$cookie = cookie()->forever('currency', $currency);
return back()->withCookie($cookie);
}
}