fix function shared_send_via_email in ShareController

This commit is contained in:
Milos Holba
2021-02-07 12:29:08 +01:00
parent bdd8d63162
commit 6f2278b908
2 changed files with 84 additions and 69 deletions

View File

@@ -147,18 +147,15 @@ class ShareController extends Controller
// Return error
if ($validator->fails()) abort(400, 'Bad emails input');
// Get shared by token
$share = Share::where('token', $token)
->where('user_id', Auth::id())
->first();
// Demo preview
if (env('APP_DEMO')) {
return response('Done!', 204);
}
// Send share link via email
$share->sendSharedLinkViaEmail($request->emails, $token);
foreach ($request->emails as $email) {
Notification::route('mail', $email)->notify(new SharedSendViaEmail($token));
}
return response('Done!', 204);
}