add for backend send shared link via email

This commit is contained in:
Milos Holba
2021-01-06 17:33:15 +01:00
parent ba28ac6184
commit 04990fcf7b
9 changed files with 119 additions and 35 deletions
+15
View File
@@ -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));
}
}