mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
33 lines
840 B
PHP
33 lines
840 B
PHP
<?php
|
|
namespace Domain\Sharing\Controllers;
|
|
|
|
use Auth;
|
|
use Domain\Sharing\Requests\ShareByEmailRequest;
|
|
use Illuminate\Http\JsonResponse;
|
|
use App\Http\Controllers\Controller;
|
|
use Domain\Sharing\Actions\SendViaEmailAction;
|
|
|
|
class ShareViaEmailController extends Controller
|
|
{
|
|
public function __construct(
|
|
private SendViaEmailAction $sendLinkToEmailAction,
|
|
) {
|
|
}
|
|
|
|
public function __invoke(
|
|
ShareByEmailRequest $request,
|
|
string $token,
|
|
): JsonResponse {
|
|
($this->sendLinkToEmailAction)->onQueue()->execute(
|
|
emails: $request->input('emails'),
|
|
token: $token,
|
|
user: Auth::user(),
|
|
);
|
|
|
|
return response()->json([
|
|
'type' => 'success',
|
|
'message' => 'The share link was shared via email successfully.',
|
|
]);
|
|
}
|
|
}
|