1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-11 07:34:22 +02:00

feat(tokens): add Tokens class #566

This commit is contained in:
Awilum
2021-08-07 17:13:48 +03:00
parent 4cd522dbb0
commit 580f618ce1

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/**
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\Tokens;
use Atomastic\Macroable\Macroable;
use Flextype\Entries;
use Exception;
class Tokens extends Entries
{
use Macroable;
public function create(string $id, array $data = []): bool
{
throw new Exception('Use generate method instead');
return false;
}
public function generate(array $data = []): string
{
$id = strings()->random()->toString();
parent::create($id, $data);
return $id;
}
}