Create TagDeleting event
ADD
app/Events/TagDeleting.php
+<?php
+
+namespace App\Events;
+
+use App\Notification;
+use App\Tag;
+use Illuminate\Broadcasting\Channel;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Broadcasting\PrivateChannel;
+use Illuminate\Broadcasting\PresenceChannel;
+use Illuminate\Foundation\Events\Dispatchable;
+use Illuminate\Broadcasting\InteractsWithSockets;
+use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
+
+class TagDeleting {
+ use Dispatchable, InteractsWithSockets, SerializesModels;
+
+ public function __construct(Tag $tag) {
+ Notification::create([
+ 'space_id' => $tag->space_id,
+ 'user_id' => \Auth::user()->id,
+ 'action' => 'tag.deleted'
+ ]);
+ }
+}

MODIFY
app/Tag.php
app/Tag.php
namespace App;
use App\Events\TagCreating;
+use App\Events\TagDeleting;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -14,7 +15,8 @@ class Tag extends Model {
protected $fillable = ['space_id', 'name'];
protected $dispatchesEvents = [
- 'creating' => TagCreating::class
+ 'creating' => TagCreating::class,
+ 'deleting' => TagDeleting::class
];
public function spendings() {

Create TagDeleting event