demo functions refactoring

This commit is contained in:
Čarodej
2022-03-05 18:09:53 +01:00
parent 81f227c5e7
commit 1e4649eec2
15 changed files with 58 additions and 28 deletions
@@ -1,4 +1,5 @@
<?php
namespace App\Users\Controllers\Authentication;
use Illuminate\Support\Str;
@@ -26,15 +27,9 @@ class AccountAccessTokenController extends Controller
*/
public function store(UserCreateAccessTokenRequest $request): Response
{
abort_if(is_demo_account(), 201, [
'name' => 'token',
'token' => Str::random(40),
'abilities' => '["*"]',
'tokenable_id' => Str::uuid(),
'updated_at' => now(),
'created_at' => now(),
'id' => Str::random(40),
]);
if (is_demo_account()) {
return response(['plainTextToken' => Str::random(40)], 201);
}
$token = Auth::user()
->createToken(