notificaties bij activiteit
This commit is contained in:
parent
57be9168e5
commit
371b75193a
@ -9,9 +9,11 @@ use App\Http\Requests\StoreMutationRequest;
|
|||||||
use App\Models\Dynamic;
|
use App\Models\Dynamic;
|
||||||
use App\Models\Ledger;
|
use App\Models\Ledger;
|
||||||
use App\Models\Mutation;
|
use App\Models\Mutation;
|
||||||
|
use App\Notifications\NewActivityNotification;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Notification;
|
||||||
|
|
||||||
class MutationController extends Controller
|
class MutationController extends Controller
|
||||||
{
|
{
|
||||||
@ -76,6 +78,17 @@ class MutationController extends Controller
|
|||||||
return $mutation;
|
return $mutation;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Notify all other participants
|
||||||
|
$recipients = $dynamic->participants()->where('users.id', '!=', $request->user()->id)->get();
|
||||||
|
$message = $status === 'approved'
|
||||||
|
? "{$request->user()->name} added a new entry: \"{$mutation->description}\"."
|
||||||
|
: "{$request->user()->name} suggested a new entry: \"{$mutation->description}\".";
|
||||||
|
|
||||||
|
Notification::send($recipients, new NewActivityNotification([
|
||||||
|
'content' => $message,
|
||||||
|
'url' => route('dynamics.ledgers.show', [$dynamic, $ledger]),
|
||||||
|
]));
|
||||||
|
|
||||||
return redirect()->route('dynamics.ledgers.show', [$dynamic, $ledger]);
|
return redirect()->route('dynamics.ledgers.show', [$dynamic, $ledger]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +164,13 @@ class MutationController extends Controller
|
|||||||
}
|
}
|
||||||
broadcast(new MessageSent($dynamicMsg));
|
broadcast(new MessageSent($dynamicMsg));
|
||||||
|
|
||||||
|
// Notify all other participants
|
||||||
|
$recipients = $dynamic->participants()->where('users.id', '!=', $request->user()->id)->get();
|
||||||
|
Notification::send($recipients, new NewActivityNotification([
|
||||||
|
'content' => "{$user->name} {$statusText} the suggestion: \"{$mutation->description}\".",
|
||||||
|
'url' => route('dynamics.ledgers.show', [$dynamic, $ledger]),
|
||||||
|
]));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +180,13 @@ class MutationController extends Controller
|
|||||||
|
|
||||||
$mutation->update(['status' => 'voided']);
|
$mutation->update(['status' => 'voided']);
|
||||||
|
|
||||||
|
// Notify all other participants
|
||||||
|
$recipients = $dynamic->participants()->where('users.id', '!=', $request->user()->id)->get();
|
||||||
|
Notification::send($recipients, new NewActivityNotification([
|
||||||
|
'content' => "{$request->user()->name} voided an entry: \"{$mutation->description}\".",
|
||||||
|
'url' => route('dynamics.ledgers.show', [$dynamic, $ledger]),
|
||||||
|
]));
|
||||||
|
|
||||||
return redirect()->route('dynamics.ledgers.show', [$dynamic, $ledger]);
|
return redirect()->route('dynamics.ledgers.show', [$dynamic, $ledger]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user