mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-16 10:15:02 +00:00
- on-demand notification
- error message on failed after shared link was created - Shared link email text edit
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\FileFunctions;
|
||||
use App\Http\Requests\Share\CreateShareRequest;
|
||||
use App\Http\Requests\Share\UpdateShareRequest;
|
||||
use App\Http\Resources\ShareResource;
|
||||
use App\Notifications\SharedSendViaEmail;
|
||||
use App\Zip;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -12,6 +13,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Share;
|
||||
use Validator;
|
||||
@@ -62,8 +64,11 @@ class ShareController extends Controller
|
||||
$share = new ShareResource(Share::create($options));
|
||||
|
||||
// Send shared link via email
|
||||
if($request->emails) {
|
||||
$share->sendSharedLinkViaEmail($request->emails, $token);
|
||||
if($request->has('emails')) {
|
||||
|
||||
foreach ($request->emails as $email) {
|
||||
Notification::route('mail', $email)->notify(new SharedSendViaEmail($token));
|
||||
}
|
||||
}
|
||||
|
||||
return $share;
|
||||
|
||||
@@ -14,11 +14,10 @@ class SharedSendViaEmail extends Notification
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
* @param $token
|
||||
*/
|
||||
public function __construct($emails, $token)
|
||||
public function __construct($token)
|
||||
{
|
||||
$this->emails = $emails;
|
||||
$this->token = $token;
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
@@ -42,16 +41,11 @@ class SharedSendViaEmail extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$notifiable->email = $this->emails;
|
||||
$shared_link = url(env('APP_URL') . '/shared' . '/' . $this->token );
|
||||
|
||||
|
||||
return (new MailMessage)
|
||||
->subject(__('vuefilemanager.shared_link_email_subject' , ['user' => $this->user->name]) . config('vuefilemanager.app_name'))
|
||||
->subject(__('vuefilemanager.shared_link_email_subject' , ['user' => $this->user->name]))
|
||||
->greeting(__('vuefilemanager.shared_link_email_greeting'))
|
||||
->line(__('vuefilemanager.shared_link_email_user', ['user' => $this->user->name, 'email' => $this->user->email]))
|
||||
->action(__('vuefilemanager.shared_link_email_link'), $shared_link);
|
||||
|
||||
->action(__('vuefilemanager.shared_link_email_link'), url('/shared', ['token' => $this->token]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-13
@@ -50,19 +50,8 @@ class Share extends Model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLinkAttribute() {
|
||||
|
||||
public function getLinkAttribute()
|
||||
{
|
||||
return url('/shared', ['token' => $this->attributes['token']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the sahared link notification.
|
||||
*
|
||||
* @param string $token $emails
|
||||
* @return void
|
||||
*/
|
||||
public function sendSharedLinkViaEmail($emails, $token)
|
||||
{
|
||||
$this->notify(new SharedSendViaEmail($emails, $token));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user