mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
add for backend send shared link via email
This commit is contained in:
@@ -117,4 +117,21 @@ class ShareController extends Controller
|
||||
// Done
|
||||
return response('Done!', 204);
|
||||
}
|
||||
|
||||
public function shared_send_via_email (Request $request, $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);
|
||||
|
||||
return response('Done!', 204);
|
||||
}
|
||||
}
|
||||
|
||||
69
app/Notifications/SharedSendViaEmail.php
Normal file
69
app/Notifications/SharedSendViaEmail.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class SharedSendViaEmail extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($emails, $token)
|
||||
{
|
||||
$this->emails = $emails;
|
||||
$this->token = $token;
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$notifiable->email = $this->emails;
|
||||
$shared_link = url(env('APP_URL') . '/shared' . '/' . $this->token );
|
||||
|
||||
|
||||
return (new MailMessage)
|
||||
->subject(__('vuefilemanager.reset_password_subject') . config('vuefilemanager.app_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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Notifications\SharedSendViaEmail;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
/**
|
||||
* App\Share
|
||||
@@ -37,6 +39,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Share extends Model
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $appends = ['link'];
|
||||
@@ -50,4 +54,15 @@ class Share extends Model
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
return [
|
||||
|
||||
'version' => '1.8',
|
||||
'version' => '1.8.1',
|
||||
|
||||
// Define size of chunk uploaded by MB. E.g. integer 128 means chunk size will be 128MB.
|
||||
'chunk_size' => env('CHUNK_SIZE', '128'),
|
||||
|
||||
@@ -74,38 +74,5 @@
|
||||
"/chunks/user-password.js": "/chunks/user-password.js?id=ac51d17a4aa7ae50bc88",
|
||||
"/chunks/user-storage.js": "/chunks/user-storage.js?id=5cfec8a8f8a8aef24ef2",
|
||||
"/chunks/user-subscription.js": "/chunks/user-subscription.js?id=34603496ceacb8bd2da3",
|
||||
"/chunks/users.js": "/chunks/users.js?id=6e68cb068f69fba3199c",
|
||||
"/chunks/profile.48e4d5c4c778d047693b.hot-update.js": "/chunks/profile.48e4d5c4c778d047693b.hot-update.js",
|
||||
"/chunks/profile.cf35785b076d2ea8bf59.hot-update.js": "/chunks/profile.cf35785b076d2ea8bf59.hot-update.js",
|
||||
"/chunks/profile.f2bdfd9a65568dca5f65.hot-update.js": "/chunks/profile.f2bdfd9a65568dca5f65.hot-update.js",
|
||||
"/chunks/profile.4281151680b57b017d09.hot-update.js": "/chunks/profile.4281151680b57b017d09.hot-update.js",
|
||||
"/chunks/profile.b0da8d0c2aebcdc9a15b.hot-update.js": "/chunks/profile.b0da8d0c2aebcdc9a15b.hot-update.js",
|
||||
"/chunks/profile.0cde8b34baad98d1eddf.hot-update.js": "/chunks/profile.0cde8b34baad98d1eddf.hot-update.js",
|
||||
"/chunks/profile.8bf98609e94b605774ed.hot-update.js": "/chunks/profile.8bf98609e94b605774ed.hot-update.js",
|
||||
"/chunks/profile.ea11c5762ac710f99855.hot-update.js": "/chunks/profile.ea11c5762ac710f99855.hot-update.js",
|
||||
"/chunks/profile.6f39169aa82eaf172f07.hot-update.js": "/chunks/profile.6f39169aa82eaf172f07.hot-update.js",
|
||||
"/chunks/profile.749c8df3990b8146a27f.hot-update.js": "/chunks/profile.749c8df3990b8146a27f.hot-update.js",
|
||||
"/chunks/profile.d23c566cc2d84f35d01e.hot-update.js": "/chunks/profile.d23c566cc2d84f35d01e.hot-update.js",
|
||||
"/chunks/profile.913083302dce6860cea2.hot-update.js": "/chunks/profile.913083302dce6860cea2.hot-update.js",
|
||||
"/chunks/profile.2e1b5ab5c9a2289a0ab9.hot-update.js": "/chunks/profile.2e1b5ab5c9a2289a0ab9.hot-update.js",
|
||||
"/chunks/profile.f3655d3d3e0d0345044b.hot-update.js": "/chunks/profile.f3655d3d3e0d0345044b.hot-update.js",
|
||||
"/chunks/profile.8d71d69db264c4930f61.hot-update.js": "/chunks/profile.8d71d69db264c4930f61.hot-update.js",
|
||||
"/chunks/profile.4a76781d8cd65ca01ad5.hot-update.js": "/chunks/profile.4a76781d8cd65ca01ad5.hot-update.js",
|
||||
"/chunks/profile.aebb498400de6f657dd9.hot-update.js": "/chunks/profile.aebb498400de6f657dd9.hot-update.js",
|
||||
"/chunks/profile.575719f7c08ec40a0beb.hot-update.js": "/chunks/profile.575719f7c08ec40a0beb.hot-update.js",
|
||||
"/chunks/profile.7ddb05f4a448a2e0ada7.hot-update.js": "/chunks/profile.7ddb05f4a448a2e0ada7.hot-update.js",
|
||||
"/chunks/profile.f22b089608a126873345.hot-update.js": "/chunks/profile.f22b089608a126873345.hot-update.js",
|
||||
"/chunks/profile.ccdadf038bc7b9809093.hot-update.js": "/chunks/profile.ccdadf038bc7b9809093.hot-update.js",
|
||||
"/chunks/profile.8968ca0391d2ffdd3f7d.hot-update.js": "/chunks/profile.8968ca0391d2ffdd3f7d.hot-update.js",
|
||||
"/chunks/profile.2984a400ad28091d27f0.hot-update.js": "/chunks/profile.2984a400ad28091d27f0.hot-update.js",
|
||||
"/chunks/profile.28f64ac138e75f4aee02.hot-update.js": "/chunks/profile.28f64ac138e75f4aee02.hot-update.js",
|
||||
"/chunks/profile.711fb4c234c4dcef1916.hot-update.js": "/chunks/profile.711fb4c234c4dcef1916.hot-update.js",
|
||||
"/chunks/profile.d5977267dfceca8b2e60.hot-update.js": "/chunks/profile.d5977267dfceca8b2e60.hot-update.js",
|
||||
"/js/main.7f9c080317d86905d411.hot-update.js": "/js/main.7f9c080317d86905d411.hot-update.js",
|
||||
"/js/main.b744b01553b04c6b839f.hot-update.js": "/js/main.b744b01553b04c6b839f.hot-update.js",
|
||||
"/chunks/profile.fc55c80000f813c649df.hot-update.js": "/chunks/profile.fc55c80000f813c649df.hot-update.js",
|
||||
"/js/main.403a2bf36e663ed79525.hot-update.js": "/js/main.403a2bf36e663ed79525.hot-update.js",
|
||||
"/js/main.dd946068d5b6a91a1045.hot-update.js": "/js/main.dd946068d5b6a91a1045.hot-update.js",
|
||||
"/chunks/profile.192f673895b9befd2bcc.hot-update.js": "/chunks/profile.192f673895b9befd2bcc.hot-update.js",
|
||||
"/js/main.3def6113de0b8b6f628b.hot-update.js": "/js/main.3def6113de0b8b6f628b.hot-update.js"
|
||||
"/chunks/users.js": "/chunks/users.js?id=6e68cb068f69fba3199c"
|
||||
}
|
||||
|
||||
@@ -7,6 +7,11 @@ return [
|
||||
'time' => '%d. %B. %Y 于 %H:%M',
|
||||
'home' => '首页',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_greeting' => 'Hello!',
|
||||
'shared_link_email_user' => ':user (:email) send you a link to shared files.',
|
||||
'shared_link_email_link' => 'Your files',
|
||||
|
||||
// Reset password email
|
||||
'reset_password_greeting' => 'Hello!',
|
||||
'reset_password_subject' => 'Reset password for your account on ',
|
||||
|
||||
@@ -7,6 +7,11 @@ return [
|
||||
'time' => '%d. %B. %Y at %H:%M',
|
||||
'home' => 'Home',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_greeting' => 'Hello!',
|
||||
'shared_link_email_user' => ':user (:email) send you a link to shared files.',
|
||||
'shared_link_email_link' => 'Your files',
|
||||
|
||||
// Reset password email
|
||||
'reset_password_greeting' => 'Hello!',
|
||||
'reset_password_subject' => 'Reset password for your account on ',
|
||||
|
||||
@@ -7,6 +7,11 @@ return [
|
||||
'time' => '%d. %B. %Y o %H:%M',
|
||||
'home' => 'Domov',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_greeting' => 'Ahoj!',
|
||||
'shared_link_email_user' => ':user (:email) ti posiela odkaz pre zdielane súbory.',
|
||||
'shared_link_email_link' => 'Vaše súbory',
|
||||
|
||||
// Reset password email
|
||||
'reset_password_greeting' => 'Ahoj!',
|
||||
'reset_password_subject' => 'Resetujte svoje heslo v aplikácií ',
|
||||
|
||||
@@ -117,6 +117,7 @@ Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], func
|
||||
Route::post('/folders/favourites', 'FileFunctions\FavouriteController@store');
|
||||
|
||||
// Share
|
||||
Route::post('/share/{token}/send-email', 'FileFunctions\ShareController@shared_send_via_email');
|
||||
Route::post('/share/cancel', 'FileFunctions\ShareController@destroy');
|
||||
Route::patch('/share/{token}', 'FileFunctions\ShareController@update');
|
||||
Route::post('/share', 'FileFunctions\ShareController@store');
|
||||
|
||||
Reference in New Issue
Block a user