I have a Notification class that tells me when a Servers Status has changed and sends a slack notification saying so, I also have applications connected to servers in a one to many relationship (An app can have many servers).
What I am trying to do now is make it so that when a server goes down or up it tells says something like "hey this server is down, these apps may be affected also"
It seems as if you cannot use loops inside of a ->content()
tag in notifications, I have a collection of names of apps related but I cant figure out how to display them, Attached below is what i'm currently attempting to do, but the display is just saying 'array' picture posted below.
$appServers = AppServer::join('apps', 'apps.id', '=', 'app_servers.app_id')
->where('server_id', $notifiable->server_id)->get();
dd($appServers->pluck('name'));
if($notifiable->status_id === '1'){
return (new SlackMessage)
->content($notifiable->server->name.' went back online! :grinning:')
// ->attachment(function ($attachment) use ($appServers) {
// $attachment->title('Applications Affected:')
->content($appServers->all());
// });
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire