Хотелось бы узнать, как расположить кнопки рядом друг с другом.
Теперь это отдельная строка.
@component('mail::message')
Dear {{$vendor_name}}
Product {{$product_id}} : {{$product_name}} price id : {{$price_id}} will expire on {{$date_expire}}.
Please renew price.
@component('mail::button', ['url' => 'http://phuketjettour.com/', 'color' => 'green'])
Phuket Jet Tour
@endcomponent
@component('mail::button', ['url' => 'http://phuketjettour.com/s/vendors'])
Vendor submission
@endcomponent
Thanks,<br>
Phuket Jet Tour
@endcomponent
@ Дорогие волки, я обновляю лезвие в посте.






можно положить в один <div>
Например:
<div class = "row>
ваши кнопки здесь
</div>
Если это не помогает, поделитесь своим кодом
Попробуй это:
<span style = "display: inline;">
@component('mail::button', ['url' => 'http://phuketjettour.com/', 'color' => 'green'])
Phuket Jet Tour
@endcomponent
@component('mail::button', ['url' => 'http://phuketjettour.com/s/vendors'])
Vendor submission
@endcomponent
</span>
Это просто работа. Я проверял электронную почту из проекта laravel.
попробуйте это вместо вашего компонента для кнопки:
<a href = "http://phuketjettour.com/" class = "button button-green"> Phuket Jet Tour</a>
<a href = "http://phuketjettour.com/" class = "button button-blue">SAMPLE !</a>
он вставляет вашу кнопку. затем просто настройте другой элемент. Если вы хотите поставить кнопку на уценку, вам понравится:
По вашей уценке:
$button1= " <a href = "http://phuketjettour.com/" class = "button button-green"> Phuket Jet Tour</a>";
$button2 = "<a href = "http://phuketjettour.com/" class = "button button-blue">SAMPLE !</a>";
$emailMarkdown = $this->markdown('your_email_template')
->subject('your_subject)
//you will define here the variables you need to pass in the template
->with([
'emailBody' => $emailBody,
'button_first' => $button1,
'button_second' => $button2,
]);
return $emailMarkdown;
затем в шаблоне электронного письма:
@component('mail::message')
Dear {{$vendor_name}}
Product {{$product_id}} : {{$product_name}} price id : {{$price_id}} will expire on {{$date_expire}}.
Please renew price.
{!!$button_first!!} {!!$button_second!!}
@endcomponent
если использовать html в уценке. он меняет html на строку Product 19361: 2142352 price id: 2124284 истекает 2018-12-27 00:00:00. Пожалуйста, обновите цену. <a href = "phuketjettour.com" class = "button button-green"> Jet Tour на Пхукете </a> <a href = "phuketjettour.com" class = "button button-blue"> ОБРАЗЕЦ! </a>
то, что я делаю, вы прямо нажимаете кнопку на шаблоне электронной почты.
Я сделал это так, конечно, css должен быть в отдельном файле
<style>
.email-row {
}
.email-col-2 {
width: 49%;
display: inline-block;
}
</style>
@component('mail::message')
<div class = "email-row">
<div class = "email-col-2">
@component('mail::button', ['url' => '453634', 'color' => 'light'])
btn1
@endcomponent
</div>
<div class = "email-col-2">
@component('mail::button', ['url' => '123', 'color' => 'green'])
bnt2
@endcomponent
</div>
</div>
@endcomponent
При передаче переменной в шаблон лезвия используйте одинарную кавычку (') вместо двойной кавычки (").
$btn_style = " color: #FFF; border: 1px solid #FEFEFE; padding: 5px 30px;";
$buttons = '<span style = "text-align: center; width: 100%; display: inline-block;">
<a href = "'. url('/login') .'" style = "background: #449a44; '.$btn_style.'"> Accept </a>
<a href = "'. url('/some/url/'. $id) .'" style = "background: #b76161; '.$btn_style.'"> Decline </a>
</span>';
Чтобы отобразить этот код:
Отредактируйте свой Приложение \ Почта
$this
->subject('Subject')
->markdown('emails.tempalte')
->with([
'buttons' => $buttons,
]);
Шаблон лезвия просмотр \ электронные письма:
{!! $buttons !!}
Надеюсь это поможет.
Чтобы решить эту проблему, просто поместите этот код в блейд-файл электронной почты:
<div style = "text-align: center">
<a href = "{{ $link }}" class = "button button-red">Cancel</a>
<a href = "{{ $link }}" class = "button button-blue">Reschedule</a>
<a href = "{{ $link }}" class = "button button-green">Confirm</a>
</div>
Для меня сработало следующее, чтобы создать 2, 3, 4 (динамическое количество) кнопок, встроенных в сообщения Laravel markdown:
Сначала давайте расширим конфигурацию почты, включив в нее наш новый каталог для компонентов:
config / mail.php
<?php
// ...
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
resource_path('views/emails/components') // <-- This line was added
],
],
Вам необходимо создать как HTML, так и текстовую версию компонента. В противном случае вы получите InvalidArgumentException «View $ name not found»:
www / ресурсы / просмотры / электронные письма / компоненты / html / buttons.blade.php
Это файл HTML:
<table class = "action" align = "center" width = "100%" cellpadding = "0" cellspacing = "0" role = "presentation">
<tr>
<td align = "center">
<table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" role = "presentation">
<tr>
<td align = "center">
<table border = "0" cellpadding = "0" cellspacing = "0" role = "presentation">
@if (null !== ($headline ?? null))
<tr><td><h2 style = "text-align: center;">{{ $headline }}</h2></td></tr>
@endif
<tr>
<td>
@foreach($buttons as $button)
<a href = "{{ $button['url'] }}" class = "button button-{{ $button['color'] ?? 'primary' }}" target = "_blank" rel = "noopener">{!! $button['slot'] !!}</a>
@endforeach
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
www / ресурсы / просмотры / электронные письма / компоненты / текст / buttons.blade.php
Это файл текст
@if (null !== ($headline ?? null))
{{ $headline }}
------------------------------
@endif
@foreach($buttons as $button)
{!! $button['slot'] !!}: {{ $button['url'] }}
@endforeach
Теперь вы можете просто включить компонент в свои электронные письма с уценкой следующим образом:
Пример с 2 встроенные кнопки и Заголовок:
@component('mail::buttons', [
'headline' => 'Share link',
'buttons' => [
[
'url' => 'https://wa.me/?text=' . urlencode('Whatsapp text'),
'slot' => 'WhatsApp',
],[
'url' => 'https://t.me/share/url?text=' . urlencode('telegram text'),
'slot' => 'Telegram',
]
]
])
@endcomponent
Пример с заголовком 3 встроенные кнопкибез:
@component('mail::buttons', [
'buttons' => [
[
'url' => 'https://wa.me/?text=' . urlencode('Whatsapp text'),
'slot' => 'WhatsApp',
],[
'url' => 'https://t.me/share/url?text=' . urlencode('telegram text'),
'slot' => 'Telegram',
],[
'url' => 'https://twitter.com/intent/tweet?text=' . urlencode('Twitter text'),
'slot' => 'Twitter',
]
]
])
@endcomponent
Пример с 3 встроенные кнопки с другим цвета:
@component('mail::buttons', [
'buttons' => [
[
'url' => 'https://wa.me/?text=' . urlencode('Whatsapp text'),
'slot' => 'WhatsApp',
'color' => 'blue' // This is the default
],[
'url' => 'https://t.me/share/url?text=' . urlencode('telegram text'),
'slot' => 'Telegram',
'color' => 'green'
],[
'url' => 'https://twitter.com/intent/tweet?text=' . urlencode('Twitter text'),
'slot' => 'Twitter',
'color' => 'red'
]
]
])
@endcomponent
пожалуйста, опубликуйте свой адрес электронной почты или код, в котором вы настраиваете эту кнопку