{"id":12647,"date":"2024-05-19T07:00:35","date_gmt":"2024-05-18T22:00:35","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=12647"},"modified":"2024-04-27T04:24:11","modified_gmt":"2024-04-26T19:24:11","slug":"laravel%ef%bc%9a%e8%aa%ac%e6%98%8e%e4%bc%9a%e3%82%92%e5%bf%98%e3%82%8c%e3%81%aa%e3%81%84%e3%82%88%e3%81%86%e3%81%ab%e3%82%ab%e3%83%ac%e3%83%b3%e3%83%80%e3%83%bc%e9%80%a3%e6%90%ba%e3%81%a7%e3%81%8d","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=12647","title":{"rendered":"Laravel\uff1a\u8aac\u660e\u4f1a\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u9023\u643a\u3067\u304d\u308b\u30e1\u30fc\u30eb"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u307e\u3060\u307e\u3060\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u52c9\u5f37\u306e\u4f59\u97fb\u304c\u6b8b\u3063\u3066\u3044\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002<br \/>\n\u3053\u3046\u3044\u3063\u305f\u52c9\u5f37\u3092\u3059\u308b\u3068\u3001\u65e5\u5e38\u304b\u3089\u300c<strong>\u3042\u3001\u3053\u308c\u3063\u3066\u30a2\u30ec\u306b\u4f7f\u3048\u308b\u3093\u3058\u3083\u306a\u3044\uff1f\uff1f<\/strong>\u300d\u3063\u3066\u601d\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u3093\u306a\u4e2d\u601d\u3044\u3064\u3044\u305f\u306e\u304c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u30ab\u30ec\u30f3\u30c0\u30fc\u9023\u643a\u3067\u304d\u308b\u30e1\u30fc\u30eb<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3069\u3046\u3044\u3046\u3053\u3068\u304b\u3068\u8a00\u3046\u3068\u3001\u30e1\u30fc\u30eb\u306b<code>.ics<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u6dfb\u4ed8\u3057\u3066\u304a\u3044\u3066<br \/>\n\u30e1\u30fc\u30eb\u3092\u958b\u3044\u305f\u3068\u304d\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u767b\u9332\u3092\u3055\u305b\u308b\u3088\u3046\u306b\u3059\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u5546\u54c1\u3084\u30b5\u30fc\u30d3\u30b9\u3001\u30bb\u30df\u30ca\u30fc\u306e\u65e5\u6642\u3063\u3066<br \/>\n\u5fd8\u308c\u3089\u308c\u3066\u3057\u307e\u3063\u305f\u308a\u3057\u307e\u3059\u304c\u3001\u3053\u308c\u3092\u4e88\u9632\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u6d41\u308c\u306f\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30a4\u30d9\u30f3\u30c8\u53c2\u52a0\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u9001\u4fe1<\/li>\n<li>\u5b8c\u4e86\u30e1\u30fc\u30eb\u3092\u9001\u4fe1<\/li>\n<li>ics \u304c\u6dfb\u4ed8\u3057\u3066\u3044\u308b\u306e\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u767b\u9332\u3067\u304d\u308b<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12648\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1.png\" alt=\"\" width=\"579\" height=\"231\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1.png 579w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1-300x120.png 300w\" sizes=\"auto, (max-width: 579px) 100vw, 579px\" \/><\/p>\n<p>\u203b \u3053\u308c\u306f\u3001<code>gmail<\/code>\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>Laravel<\/code>\u3067\u3053\u306e<code>ics<\/code>\u30d5\u30a1\u30a4\u30eb\u4ed8\u304d\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u3001<br \/>\n\u300c<strong>\u5c11\u3057\u3067\u3082\u53c2\u52a0\u4eba\u6570\u3092\u5897\u3084\u3059<\/strong>\u300d\u3068\u3044\u3046\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306b\u95a2\u9023\u3057\u305f\u5b9f\u88c5\u3092\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude0a\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6070 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_5.png\" alt=\"\" width=\"260\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_5.png 260w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_5-244x300.png 244w\" sizes=\"auto, (max-width: 260px) 100vw, 260px\" \/>\u300c\u30c4\u30a4\u30c3\u30bf\u30fc\u6559\u6750\u3092\u8cb7\u3063\u305f\u306e\u3067\u3001<br \/>\n\u6295\u7a3f\u3059\u308b\u30c4\u30a4\u30fc\u30c8\u3092\u5927\u91cf\u751f\u7523\u3057\u3066\u307e\u3059\uff01\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 11.x<\/p>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p><code>.ics<\/code>\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092<code>Spatie<\/code>\u3055\u3093\u304c\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001<br \/>\n\u3053\u308c\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002\uff08\u3044\u3064\u3082\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u2757\uff09<\/p>\n<pre><strong>composer require spatie\/icalendar-generator<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u6e96\u5099\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u3053\u3053\u304b\u3089\u306f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3057\u3087\u3046\ud83d\ude0a<\/p>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4eca\u56de\u306f<code>DB<\/code>\u5468\u308a\u306f\u4e0d\u8981\u306a\u306e\u3067\u3001<br \/>\n\u3044\u304d\u306a\u308a\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:controller ApplicationController<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001<br \/>\n\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/ApplicationController.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Controllers;<\/strong>\r\n\r\n<strong>use App\\Mail\\EventApplied;<\/strong>\r\n<strong>use Carbon\\Carbon;<\/strong>\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Mail;<\/strong>\r\n<strong>use Spatie\\IcalendarGenerator\\Components\\Calendar;<\/strong>\r\n<strong>use Spatie\\IcalendarGenerator\\Components\\Event;<\/strong>\r\n<strong>use Spatie\\IcalendarGenerator\\Properties\\TextProperty;<\/strong>\r\n\r\n<strong>class ApplicationController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    private $event;<\/strong>\r\n\r\n<strong>    public function __construct()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $dt = Carbon::now();<\/strong>\r\n<strong>        $start_dt = $dt-&gt;addDays(7)-&gt;setTime(19, 0, 0); \/\/ 1\u9031\u9593\u5f8c\u306e19\u6642\u304b\u3089\u30a4\u30d9\u30f3\u30c8\u958b\u59cb<\/strong>\r\n<strong>        $end_dt = $start_dt-&gt;copy()-&gt;addHours(2); \/\/ \u958b\u59cb\u304b\u30892\u6642\u9593\u5f8c\u306b\u30a4\u30d9\u30f3\u30c8\u7d42\u4e86<\/strong>\r\n\r\n<strong>        $this-&gt;event = [<\/strong>\r\n<strong>            'name' =&gt; '\u65b0\u30b5\u30fc\u30d3\u30b9\u300cConsole dot Log\u300d\u53c2\u52a0\u8aac\u660e\u4f1a',<\/strong>\r\n<strong>            'description' =&gt; '\u65b0\u30b5\u30fc\u30d3\u30b9\u300cConsole dot Log\u300d\u306e\u53c2\u52a0\u8aac\u660e\u4f1a\u3067\u3059\u3002',<\/strong>\r\n<strong>            'location' =&gt; [<\/strong>\r\n<strong>                'address' =&gt; '\u6771\u4eac\u90fd\u25cf\u25cf\u533a\u4e38\u25cf\u25cf\uff11\u2212\uff12\u2212\uff13\uff14',<\/strong>\r\n<strong>                'address_name' =&gt; 'SUKOHI \u30bf\u30ef\u30fc\u30d3\u30eb \uff12\uff17\u968e',<\/strong>\r\n<strong>                'coordinates' =&gt; [<\/strong>\r\n<strong>                    'lat' =&gt; 35.123456,<\/strong>\r\n<strong>                    'lng' =&gt; 139.123456,<\/strong>\r\n<strong>                ],<\/strong>\r\n<strong>            ],<\/strong>\r\n<strong>            'organizer' =&gt; [<\/strong>\r\n<strong>                'name' =&gt; '\u682a\u5f0f\u4f1a\u793e \u4e5d\u4fdd\u3059\u3053\u3072',<\/strong>\r\n<strong>                'email' =&gt; 'sukohi@example.com',<\/strong>\r\n<strong>            ],<\/strong>\r\n<strong>            'start_dt' =&gt; $start_dt,<\/strong>\r\n<strong>            'end_dt' =&gt; $end_dt,<\/strong>\r\n<strong>        ];<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function create()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return view('application.create', [<\/strong>\r\n<strong>            'event' =&gt; $this-&gt;event,<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function store(Request $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        \/\/ \u6ce8\uff1a \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u7701\u7565\u3057\u3066\u307e\u3059<\/strong>\r\n\r\n<strong>        \/\/ \u672c\u6765\u306f\u3053\u3053\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3059\u308b\u51e6\u7406\u3092\u66f8\u304f<\/strong>\r\n\r\n<strong>        \/\/ ics \u30c7\u30fc\u30bf\u3092\u4f5c\u6210<\/strong>\r\n<strong>        $ics_event = Event::create()<\/strong>\r\n<strong>            -&gt;name($this-&gt;event['name'])<\/strong>\r\n<strong>            -&gt;description($this-&gt;event['description'])<\/strong>\r\n<strong>            -&gt;startsAt($this-&gt;event['start_dt'])<\/strong>\r\n<strong>            -&gt;endsAt($this-&gt;event['end_dt'])<\/strong>\r\n<strong>            -&gt;address($this-&gt;event['location']['address'])<\/strong>\r\n<strong>            -&gt;addressName($this-&gt;event['location']['address_name'])<\/strong>\r\n<strong>            -&gt;coordinates(<\/strong>\r\n<strong>                $this-&gt;event['location']['coordinates']['lat'],<\/strong>\r\n<strong>                $this-&gt;event['location']['coordinates']['lng'],<\/strong>\r\n<strong>            )<\/strong>\r\n<strong>            -&gt;organizer(<\/strong>\r\n<strong>                $this-&gt;event['organizer']['email'],<\/strong>\r\n<strong>                $this-&gt;event['organizer']['name'],<\/strong>\r\n<strong>            );<\/strong>\r\n\r\n<strong>        $ics_calendar = Calendar::create()<\/strong>\r\n<strong>            -&gt;appendProperty(<\/strong>\r\n<strong>                TextProperty::create('METHOD', 'REQUEST')<\/strong>\r\n<strong>            )<\/strong>\r\n<strong>            -&gt;event($ics_event);<\/strong>\r\n<strong>        $ics_content = $ics_calendar-&gt;get();<\/strong>\r\n\r\n<strong>        \/\/ \u30e1\u30fc\u30eb\u9001\u4fe1<\/strong>\r\n<strong>        Mail::to($request-&gt;email)-&gt;send(<\/strong>\r\n<strong>            new EventApplied(<\/strong>\r\n<strong>                event: $this-&gt;event,<\/strong>\r\n<strong>                ics_content: $ics_content,<\/strong>\r\n<strong>            )<\/strong>\r\n<strong>        );<\/strong>\r\n\r\n<strong>        return '\u7533\u3057\u8fbc\u307f\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\uff01';<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p>\u306a\u304a\u3001<code>ics<\/code>\u30c7\u30fc\u30bf\u306e\u6700\u5f8c\u306e\u90e8\u5206\u3067\u300c<strong>METHOD:REQUEST<\/strong>\u300d\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u9078\u629e\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12648\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1.png\" alt=\"\" width=\"579\" height=\"231\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1.png 579w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_1-300x120.png 300w\" sizes=\"auto, (max-width: 579px) 100vw, 579px\" \/><\/p>\n<p>\u203b \u5b9f\u969b\u306e\u5185\u5bb9\u306f\u3053\u3093\u306a\u30ab\u30f3\u30b8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div>\n<pre>BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:spatie\/icalendar-generator\r\n<strong>METHOD:REQUEST &lt;---\u3053\u3053<\/strong>\r\n...<\/pre>\n<\/div>\n<p>\u306a\u304a\u3001\u3082\u3057\u300c<strong>METHOD:REQUEST<\/strong>\u300d\u3092\u3064\u3051\u306a\u3044\u5834\u5408\u3060\u3068\u3001<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c<strong>\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u8ffd\u52a0<\/strong>\u300d\u30ea\u30f3\u30af\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u304c\u3001<br \/>\n\u3042\u307e\u308a\u76ee\u7acb\u305f\u306a\u3044\u306e\u3067\u3001\u3088\u308a\u30ab\u30ec\u30f3\u30c0\u30fc\u767b\u9332\u3092\u8a34\u6c42\u3057\u305f\u3044\u5834\u5408\u306f\u30bb\u30c3\u30c8\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12649\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_2.png\" alt=\"\" width=\"611\" height=\"209\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_2.png 611w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/laravel_email_with_ics_2-300x103.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u3067\u30bb\u30c3\u30c8\u3057\u305f\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:view application.create<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d3\u30e5\u30fc\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001<br \/>\n\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/application\/create.blade.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;!DOCTYPE html&gt;<\/strong>\r\n<strong>&lt;html lang=\"ja\"&gt;<\/strong>\r\n<strong>&lt;head&gt;<\/strong>\r\n<strong>    &lt;meta charset=\"UTF-8\"&gt;<\/strong>\r\n<strong>    &lt;title&gt;{{ $event['name'] }}&lt;\/title&gt;<\/strong>\r\n<strong>    &lt;script src=\"https:\/\/cdn.tailwindcss.com\/3.4.3\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;\/head&gt;<\/strong>\r\n<strong>&lt;body class=\"bg-gray-100 flex justify-center items-center h-screen\"&gt;<\/strong>\r\n<strong>&lt;div class=\"w-full max-w-md p-8 bg-white shadow-lg rounded-lg\"&gt;<\/strong>\r\n<strong>    &lt;h2 class=\"text-md font-bold text-center mb-6\"&gt;{{ $event['name'] }}&lt;br&gt;\u767b\u9332\u30d5\u30a9\u30fc\u30e0&lt;\/h2&gt;<\/strong>\r\n<strong>    &lt;form action=\"{{ route('application.store') }}\" method=\"POST\" class=\"space-y-6\"&gt;<\/strong>\r\n<strong>        @csrf<\/strong>\r\n<strong>        &lt;input type=\"text\" name=\"name\" placeholder=\"\u304a\u540d\u524d\" class=\"w-full p-2 border border-gray-300 rounded-md\"&gt;<\/strong>\r\n<strong>        &lt;input type=\"email\" name=\"email\" placeholder=\"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\" class=\"w-full p-2 border border-gray-300 rounded-md\"&gt;<\/strong>\r\n<strong>        &lt;button type=\"submit\" class=\"w-full p-2 bg-blue-500 text-white rounded-md hover:bg-blue-600\"&gt;\u9001\u4fe1&lt;\/button&gt;<\/strong>\r\n<strong>    &lt;\/form&gt;<\/strong>\r\n<strong>&lt;\/div&gt;<\/strong>\r\n<strong>&lt;\/body&gt;<\/strong>\r\n<strong>&lt;\/html&gt;<\/strong><\/pre>\n<\/div>\n<\/div>\n<h1>\u30e1\u30fc\u30eb\u9001\u4fe1\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3061\u3089\u3082\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u3067\u30bb\u30c3\u30c8\u3057\u305f<br \/>\n<code>Mailable<\/code>\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:mail EventApplied<\/strong><\/pre>\n<p>\u3059\u308b\u3068<code>Mailable<\/code>\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001<br \/>\n\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Mail\/EventApplied.php<\/strong><\/p>\n<\/div>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Mail;<\/strong>\r\n\r\n<strong>use Illuminate\\Bus\\Queueable;<\/strong>\r\n<strong>use Illuminate\\Contracts\\Queue\\ShouldQueue;<\/strong>\r\n<strong>use Illuminate\\Mail\\Mailable;<\/strong>\r\n<strong>use Illuminate\\Mail\\Mailables\\Content;<\/strong>\r\n<strong>use Illuminate\\Mail\\Mailables\\Envelope;<\/strong>\r\n<strong>use Illuminate\\Queue\\SerializesModels;<\/strong>\r\n<strong>use Illuminate\\Mail\\Mailables\\Attachment;<\/strong>\r\n\r\n<strong>class EventApplied extends Mailable<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    use Queueable, SerializesModels;<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Create a new message instance.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function __construct(<\/strong>\r\n<strong>        private array $event,<\/strong>\r\n<strong>        private string $ics_content<\/strong>\r\n<strong>    ){}<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Get the message envelope.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function envelope(): Envelope<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return new Envelope(<\/strong>\r\n<strong>            subject: '\u53c2\u52a0\u7533\u3057\u8fbc\u307f\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\uff01',<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Get the message content definition.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function content(): Content<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return new Content(<\/strong>\r\n<strong>            view: 'emails.event_applied',<\/strong>\r\n<strong>            with: [<\/strong>\r\n<strong>                'event' =&gt; $this-&gt;event,<\/strong>\r\n<strong>            ],<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Get the attachments for the message.<\/strong>\r\n<strong>     *<\/strong>\r\n<strong>     * @return array&lt;int, \\Illuminate\\Mail\\Mailables\\Attachment&gt;<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function attachments(): array<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return [<\/strong>\r\n<strong>            Attachment::fromData(fn() =&gt; $this-&gt;ics_content, 'event.ics', 'text\/calendar')<\/strong>\r\n<strong>        ];<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p>\u3053\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u306f\u3001\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u30c7\u30fc\u30bf\u304b\u3089\u3064\u304f\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3059\u3002<br \/>\n<code>fromData()<\/code>\u3067\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/emails\/event_applied.blade.php<\/strong><\/p>\n<div>\n<pre><strong>php artisan make:view emails.event_applied<\/strong><\/pre>\n<p>\u30d3\u30e5\u30fc\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/emails\/event_applied.blade.php<\/strong><\/p>\n<div>\n<pre><strong>\u3053\u306e\u5ea6\u306f\u3001{{ $event['name'] }} \u3078\u306e\u53c2\u52a0\u7533\u3057\u8fbc\u307f\u3092\u3044\u305f\u3060\u304d\u3001&lt;br&gt;\u8aa0\u306b\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002&lt;br&gt;&lt;br&gt;<\/strong>\r\n<strong>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3067\u7533\u3057\u8fbc\u307f\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002&lt;br&gt;&lt;br&gt;<\/strong>\r\n\r\n<strong>\u8a73\u7d30\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002&lt;br&gt;<\/strong>\r\n<strong>\u6642\u9593\uff1a{{ $event['start_dt']-&gt;format('Y\u5e74m\u6708d\u65e5') }} \uff08{{ $event['start_dt']-&gt;format('H:i') }}\u301c {{ $event['end_dt']-&gt;format('H:i') }}\uff09&lt;br&gt;<\/strong>\r\n<strong>\u5834\u6240\uff1a {{ $event['location']['address_name'] }}&lt;br&gt;&lt;br&gt;<\/strong>\r\n\r\n<strong>\u5f53\u65e5\u304a\u4f1a\u3044\u3067\u304d\u308b\u306e\u3092\u697d\u3057\u307f\u306b\u3057\u3066\u304a\u308a\u307e\u3059\u3002&lt;br&gt;<\/strong>\r\n<strong>\u305c\u3072\u30ab\u30ec\u30f3\u30c0\u30fc\u3078\u306e\u4e88\u5b9a\u306e\u8ffd\u52a0\u3092\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002&lt;br&gt;&lt;br&gt;<\/strong>\r\n\r\n<strong>{{ $event['organizer']['name'] }}<\/strong><\/pre>\n<\/div>\n<\/div>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3067\u3059\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\n<strong>use App\\Http\\Controllers\\ApplicationController;<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>Route::prefix('application')-&gt;group(function () {<\/strong>\r\n<strong>    Route::get('\/create', [ApplicationController::class, 'create'])-&gt;name('application.create');<\/strong>\r\n<strong>    Route::post('\/', [ApplicationController::class, 'store'])-&gt;name('application.store');<\/strong>\r\n<strong>});<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<\/div>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u307e\u305a\u306f\u30d6\u30e9\u30a6\u30b6\u3067\u300c<strong>https:\/\/******\/application\/create<\/strong>\u300d\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001<br \/>\n\u540d\u524d\u3068\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u9001\u4fe1\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12654\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_6.png\" alt=\"\" width=\"491\" height=\"374\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_6.png 491w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_6-300x229.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12655\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_7.png\" alt=\"\" width=\"216\" height=\"44\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u5b8c\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30e1\u30fc\u30eb\u306e\u65b9\u3082\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12653\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_5.png\" alt=\"\" width=\"636\" height=\"464\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_5.png 636w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_5-300x219.png 300w\" sizes=\"auto, (max-width: 636px) 100vw, 636px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u3061\u3083\u3093\u3068\u5230\u7740\u3057\u3066\u3044\u3066\u3001<code>ics<\/code>\u30d5\u30a1\u30a4\u30eb\u3082\u6dfb\u4ed8\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u3053\u306e\u30e1\u30fc\u30eb\u8868\u793a\u306f\u958b\u767a\u7528\u306e<code>mailcatcher<\/code>\u306e\u3082\u306e\u306a\u306e\u3067\u3001<br \/>\n<code>ics<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u81ea\u5206\u81ea\u4fe1\u306e<code>gmail<\/code>\u3078\u9001\u4fe1\u3057\u3066\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12651\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_3.png\" alt=\"\" width=\"607\" height=\"253\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_3.png 607w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_3-300x125.png 300w\" sizes=\"auto, (max-width: 607px) 100vw, 607px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p><code>gmail<\/code>\u306b\u30e1\u30fc\u30eb\u304c\u5c4a\u3044\u305f\u306e\u3067\u3001\u958b\u5c01\u3057\u3066\u307f\u308b\u3068\u3001<br \/>\n\u300c\u30ab\u30fc\u30c9\u300d\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u53c2\u52a0\u3092\u8868\u660e\u3059\u308b\u300c<strong>\u306f\u3044<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u300c<strong>Google \u30ab\u30ec\u30f3\u30c0\u30fc<\/strong>\u300d\u306e\u65b9\u3067\u898b\u3066\u307f\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12652\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_4.png\" alt=\"\" width=\"482\" height=\"475\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_4.png 482w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_4-300x296.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/05\/laravel_email_with_ics_4-100x100.png 100w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u304d\u3061\u3093\u3068\u767b\u9332\u3055\u308c\u3066\u3044\u3066\u3001<br \/>\n\u3055\u3089\u306b30\u5206\u524d\u306b\u30a2\u30e9\u30fc\u30e0\u304c\u306a\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b<code>ics<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u3063\u305f\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u3068\u3001<br \/>\n\u30ab\u30ec\u30f3\u30c0\u30fc\u3078\u306e\u767b\u9332\u3084\u30a2\u30e9\u30fc\u30e0\u3092\u9cf4\u3089\u3059\u306a\u3069\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3068\u306a\u308b\u3068\u3001\u9867\u5ba2\u304c\u3088\u308a\u30a4\u30d9\u30f3\u30c8\u306b\u53c2\u52a0\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u304c\u671f\u5f85\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u3053\u306e\u30b7\u30b9\u30c6\u30e0\u3092\u4f7f\u3063\u3066\u96c6\u5ba2\u6570\u3092\u5897\u3084\u3057\u305f\u3044\u5834\u5408\u306f<br \/>\n\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude0a<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3092\u4f7f\u3063\u3066<code>ics<\/code>\u30d5\u30a1\u30a4\u30eb\u4ed8\u304d\u306e\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3082\u3057\u304b\u3059\u308b\u3068\u3001\u3088\u308a\u96c6\u5ba2\u306b\u3064\u306a\u304c\u308b\u30d1\u30fc\u30bb\u30f3\u30c6\u30fc\u30b8\u306f\u5c11\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001<br \/>\n\u6bcd\u6570\u304c\u5927\u304d\u304f\u306a\u308c\u3070\u306a\u308b\u307b\u3069\u96c6\u5ba2\u6570\u81ea\u4f53\u306f\u5897\u3048\u3066\u3044\u304f\u306e\u3067\u3001\u5c11\u3057\u3067\u3082\u30d7\u30e9\u30b9\u306b\u306a\u308b\u65bd\u7b56\u306f\u3084\u308b\u3079\u304d\u3067\u3059\u306d\u3002<\/p>\n<p>\u305c\u3072\u4eca\u56de\u306e\u30e1\u30fc\u30eb\u3092\u53c2\u8003\u306b\u3057\u3066\u4ed6\u306b\u3082\u3044\u308d\u3044\u308d\u3068\u7814\u7a76\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6069 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20.png\" alt=\"\" width=\"326\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20.png 326w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20-300x294.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/>\u300c\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u30bb\u30df\u30ca\u30fc<br \/>\n\u53c2\u52a0\u3057\u305f\u3053\u3068\u3042\u308a\u307e\u3059\ud83d\ude0a\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u307e\u3060\u307e\u3060\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u52c9\u5f37\u306e\u4f59\u97fb\u304c\u6b8b\u3063\u3066\u3044\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002 \u3053\u3046\u3044\u3063\u305f\u52c9\u5f37\u3092\u3059\u308b\u3068\u3001\u65e5\u5e38\u304b\u3089\u300c\u3042\u3001\u3053\u308c\u3063\u3066\u30a2\u30ec\u306b\u4f7f\u3048\u308b\u3093\u3058\u3083\u306a\u3044\uff1f\uff1f\u300d\u3063\u3066\u601d\u3063\u305f\u308a\u3057 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=12647\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\uff1a\u8aac\u660e\u4f1a\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u9023\u643a\u3067\u304d\u308b\u30e1\u30fc\u30eb&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":12658,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,258],"tags":[],"class_list":["post-12647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-258"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12647"}],"version-history":[{"count":3,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12647\/revisions"}],"predecessor-version":[{"id":12657,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12647\/revisions\/12657"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/12658"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}