
자격 증명을 공유하지 않고 사용자 계정에 원격 액세스 권한을 부여합니다.
자격 증명을 공유하지 않고 사용자 계정에 대한 원격 액세스를 부여합니다.
Remote Control은 composer를 통해 설치할 수 있습니다:
composer require "katsana/remote-control"
이 패키지는 서비스 프로바이더를 자동으로 등록합니다.
다음으로, Remote Control 구성 파일을 게시해야 합니다:
php artisan vendor:publish --provider="RemoteControl\RemoteServiceProvider" --tag="config"
원격 액세스를 생성하기 전에 검증 라우트를 선언해야 합니다:
RemoteControl\Remote::verifyRoute('remote-control')->middleware('web');
서명된 URL을 사용하려면 signed 미들웨어를 포함해야 합니다:
RemoteControl\Remote::verifyRoute('remote-control')->middleware(['signed', 'web']);
다음 코드를 실행하여 원격 액세스를 생성할 수 있습니다:
$user = request()->user();
$recipientEmail = '[email protected]';
$content = 'Please help me';
$accessToken = RemoteControl\Remote::create($user, $recipientEmail, $content);
다음 메서드를 사용하여 URL을 얻을 수 있습니다:
$accessToken->getUrl();
다음 메서드를 사용하여 서명된 URL도 얻을 수 있습니다:
$accessToken->getSignedUrl();
다음 Mailable을 통해 수신자에게 이메일을 자동으로 보낼 수 있습니다:
Mail::send(new RemoteControl\Mail\GrantRemoteAccess($user, $accessToken, $content));