koel/app/Http/Controllers/API/GetOneTimeTokenController.php

18 lines
449 B
PHP
Raw Normal View History

2024-04-03 14:48:52 +00:00
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Services\AuthenticationService;
use Illuminate\Contracts\Auth\Authenticatable;
class GetOneTimeTokenController extends Controller
{
/** @param User $user */
2024-04-03 14:48:52 +00:00
public function __invoke(AuthenticationService $auth, Authenticatable $user)
{
return response()->json(['token' => $auth->generateOneTimeToken($user)]);
}
}