Slack 알림에 여러 이미지를 게시하려고합니다. 수동으로 "첨부 파일"을 추가하면 허용하지만 루프를 사용하여 동적으로 첨부 파일을 추가하고 싶습니다.
다음 코드는 수동 첨부에 대해 작동합니다.
return (new SlackMessage)->attachment(function (SlackAttachment $attachment) {
$attachment->title('Title1')
->image('Image1.jpg');
})
->attachment(function (SlackAttachment $attachment) {
$attachment->title('Title2')
->image('Image2.jpg');
});
그러나 수동으로 "첨부 파일"을 전달하고 싶지 않고 루프 수에 따라 "첨부 파일"을 자동으로 연결하고 싶습니다.
이 문제를 어떻게 해결할 수 있습니까?
이 같은:
$message = new SlackMessage;
foreach($something as $something_else){
$message->attachment(function (SlackAttachment $attachment) {
$attachment->title('Title1')
->image('Image1.jpg');
})
}
return $message
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다