{"id":12583,"date":"2024-04-28T07:00:15","date_gmt":"2024-04-27T22:00:15","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=12583"},"modified":"2024-04-28T07:53:54","modified_gmt":"2024-04-27T22:53:54","slug":"laravel%ef%bc%9a%e5%88%a5%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%8b%e3%82%89%e3%81%a7%e3%82%82%e8%a1%8c%e5%8b%95%e5%b1%a5%e6%ad%b4%e3%82%92%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8b%e3%83%9e%e3%83%bc","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=12583","title":{"rendered":"Laravel\uff1a\u5225\u30c9\u30e1\u30a4\u30f3\u304b\u3089\u3067\u3082\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u6226\u7565"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u7a81\u7136\u3067\u3059\u304c\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u8d85\u30b7\u30f3\u30d7\u30eb\u306a<br \/>\n\u6975\u610f\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u6b32\u3057\u304c\u3063\u3066\u308b\u4eba\u306b\u58f2\u308b<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u9b5a\u306b\u30d5\u30e9\u30a4\u30c9\u30c1\u30ad\u30f3\u3042\u3052\u3066\u3082\u98df\u3079\u306a\u3044\u3088\u3046\u306b<br \/>\n\u305d\u306e\u5546\u54c1\u3092\u6b32\u3057\u304c\u3063\u3066\u3044\u308b\u4eba\u306b\u30bb\u30fc\u30eb\u30b9\u3092\u3057\u3066\u3044\u304f\u3079\u304d\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u3067\u3082\u3001\u591a\u304f\u306e\u304a\u5ba2\u3055\u3093\u304c\u3044\u308b\u306e\u306b\u300c<strong>\u3053\u306e\u4eba\u306f\u30d0\u30c3\u30b0\u306b\u8208\u5473\u304c\u3042\u308b<\/strong>\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u500b\u5225\u306b\u60c5\u5831\u7ba1\u7406\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u3067\u3082\u5927\u4e08\u592b\uff01<br \/>\n\u305d\u3046\u3001\u30a6\u30a7\u30d6\u306a\u3089\u306d\uff08\u3069\u3063\u304b\u306eCM\u306e\u30aa\u30de\u30fc\u30b8\u30e5\u3067\u3059\ud83d\ude02\uff09<\/p>\n<p>\u3064\u307e\u308a\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u4e2d\u306b\u300c<strong>\u30e6\u30fc\u30b6\u30fc\u306e\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b<\/strong>\u300d<br \/>\n\u3088\u3046\u306b\u3059\u308c\u3070\u826f\u3044\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30d0\u30c3\u30b0\u306e\u5546\u54c1\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3089\u300c<strong>\u30d0\u30c3\u30b0<\/strong>\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u30bf\u30b0\u4ed8\u3051\u3092\u3057\u3066\u3044\u304f\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u30d0\u30c3\u30b0\u306e\u5272\u5f15\u30bb\u30fc\u30eb\u304c\u3042\u308b\u3068\u304d\u306f\u300c<strong>\u30d0\u30c3\u30b0<\/strong>\u300d\u306e\u30bf\u30b0\u4ed8\u3051\u304c\u3042\u308b\u4eba\u3060\u3051\u306b\u30e1\u30eb\u30de\u30ac\u9001\u4fe1\u3057\u305f\u308a\u3067\u304d\u307e\u3059\u3057\u3001\u7bc4\u56f2\u3092\u5e83\u3052\u3066\u300c<strong>\u670d\u98fe<\/strong>\u300d\u3068\u3044\u3046\u3088\u308a\u5927\u304d\u306a\u30b0\u30eb\u30fc\u30d7\u5206\u3051\u3092\u3057\u3066\u30a2\u30d7\u30ed\u30fc\u30c1\u3057\u305f\u308a\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>Laravel<\/code>\u3092\u4f7f\u3063\u3066\u300c<strong>\u5225\u30c9\u30e1\u30a4\u30f3\u304b\u3089\u3067\u3082\u884c\u52d5\u5c65\u6b74\u304c\u4fdd\u5b58\u3067\u304d\u308b<\/strong>\u300d\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\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-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/>\u300c\u500b\u4eba\u7684\u306b\u904b\u55b6\u3057\u3066\u308b\u30b5\u30fc\u30d3\u30b9\u306b<br \/>\n\u307f\u3093\u306a\u304c\u5199\u771f\u3092\u6295\u7a3f\u3057\u3066\u304f\u308c\u3066<br \/>\n\u5b09\u3057\u3044\u9650\u308a\u3067\u3059\u2757\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 11.x\uff08<code>Blade<\/code>\u7248\u3067\u30ed\u30b0\u30a4\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff09<\/p>\n<h1>\u9375\u306b\u306a\u308b\u306e\u306f\u300c\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u300d<\/h1>\n<p>\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3068\u306f\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068\u300c<strong>\u30c7\u30fc\u30bf\u3092\u4ed6\u30b5\u30a4\u30c8\u3078\u901a\u77e5\u3059\u308b<\/strong>\u300d<br \/>\n\u753b\u50cf\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u904e\u53bb\u306b\u3088\u304f\u4f7f\u308f\u308c\u305f\u306e\u304c<strong>\u30e1\u30fc\u30eb\u306b\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u753b\u50cf\u3092\u4ed5\u8fbc\u3093\u3067\u304a\u304d\u3001\u305d\u306e\u30e1\u30fc\u30eb\u304c\u958b\u5c01\u3055\u308c\u305f\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af<\/strong>\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001<code>G-Mail<\/code>\u306e\u3088\u3046\u306b\uff08\u521d\u671f\u72b6\u614b\u3067\uff09\u30e1\u30fc\u30eb\u5185\u306e\u753b\u50cf\u3092<br \/>\n\u8868\u793a\u3057\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u305f\u305f\u3081\u3053\u306e\u624b\u6cd5\u306f\u4f7f\u3044\u306b\u304f\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306a\u3089<code>&lt;img&gt;<\/code>\u30bf\u30b0\u3068\u3057\u3066\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3092\u4ed5\u8fbc\u3093\u3067\u304a\u304f\u3053\u3068\u306f\u7c21\u5358\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4eca\u56de\u306f\u5225\u30c9\u30e1\u30a4\u30f3\u306e\u59c9\u59b9\u30b5\u30a4\u30c8\u3084\u3001\u30d6\u30ed\u30b0\u306b<br \/>\n\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3092\u30bb\u30c3\u30c8\u3057\u3066\u304a\u304d\u3001\u30e1\u30a4\u30f3\u306e\u30b5\u30a4\u30c8\u3067<br \/>\n\u30e6\u30fc\u30b6\u30fc\u306e\u884c\u52d5\u5c65\u6b74\u3092\u53d7\u3051\u53d6\u3063\u3066\u4fdd\u5b58\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30b5\u30a4\u30c8 A \u3067\u30e6\u30fc\u30b6\u30fc\u304c\u30ed\u30b0\u30a4\u30f3\u3059\u308b\uff08\u3053\u3053\u3067 Cookie \u306b user_id \u3092\u4fdd\u5b58\uff09<\/li>\n<li>\u30b5\u30a4\u30c8 B\uff08\u5225\u30c9\u30e1\u30a4\u30f3\uff09\u306e\u30b5\u30a4\u30c8\u3078\u79fb\u52d5<\/li>\n<li>\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u753b\u50cf\u304c\u8aad\u307f\u8fbc\u307e\u308c\u308b\uff08\u884c\u52d5\u5c65\u6b74\u3092\u9001\u4fe1\uff09<\/li>\n<li>\u30b5\u30a4\u30c8 A \u306e\u4e2d\u3067\u53d7\u4fe1\u3057\u305f\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58<\/li>\n<\/ol>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001<strong>\u300c\u30b5\u30a4\u30c8A\u300d\u3060\u3051\u3058\u3083\u306a\u304f\u300c\u30b5\u30a4\u30c8B\u300d\u307e\u3067\u307e\u308b\u3063\u3068\u884c\u52d5\u5c65\u6b74\u3092\u53d6\u5f97\u3067\u304d\u308b<\/strong>\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3068\u306a\u308b\u3068\u3001\u3088\u308a\u305f\u304f\u3055\u3093\u306e\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u304c\u96c6\u307e\u308b\u306e\u3067\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306b\u3082\u6d3b\u7528\u3057\u3084\u3059\u3044\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\u2757<\/p>\n<h1>\u753b\u50cf\u3092\u7528\u610f\u3059\u308b<\/h1>\n<p>\u901a\u5e38\u3001\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u306f\u8a2a\u554f\u30e6\u30fc\u30b6\u30fc\u306b\u898b\u305b\u308b\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u591a\u304f\u306e\u30b1\u30fc\u30b9\u3067\u306f\u753b\u50cf\u30b5\u30a4\u30ba\u304c\u300c<strong>1&#215;1\u30d4\u30af\u30bb\u30eb<\/strong>\u300d\uff06\u300c<strong>\u900f\u904e gif<\/strong>\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u76ee\u306b\u898b\u3048\u306a\u3044\u3053\u3068\u304c\u307b\u3068\u3093\u3069\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u305d\u308c\u3067\u306f\u3061\u3087\u3063\u3068\u691c\u8a3c\u304c\u3057\u306b\u304f\u3044\u306e\u3067\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u753b\u50cf\u3092\u4f7f\u3063\u3066\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3092\u3064\u304f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12598\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_1.png\" alt=\"\" width=\"245\" height=\"245\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_1.png 245w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_1-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_1-100x100.png 100w\" sizes=\"auto, (max-width: 245px) 100vw, 245px\" \/><\/p>\n<p>\u203b B&#8217;z \u5f3e\u3044\u3066\u307e\u3059\ud83d\ude02\u2728<\/p>\n<h1>DB \u307e\u308f\u308a\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067<code>DB<\/code>\u5468\u308a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<div>\n<pre><strong>php artisan make:model UserAction -m<\/strong><\/pre>\n<\/div>\n<p>\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u304c\u4eca\u56de\u306f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u307f\u3067\u3059\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_user_actions_table.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>use Illuminate\\Database\\Migrations\\Migration;<\/strong>\r\n<strong>use Illuminate\\Database\\Schema\\Blueprint;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Schema;<\/strong>\r\n\r\n<strong>return new class extends Migration<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    \/**<\/strong>\r\n<strong>     * Run the migrations.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function up(): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        Schema::create('user_actions', function (Blueprint $table) {<\/strong>\r\n<strong>            $table-&gt;id();<\/strong>\r\n<strong>            $table-&gt;unsignedBigInteger('user_id')-&gt;comment('\u30e6\u30fc\u30b6\u30fcID');<\/strong>\r\n<strong>            $table-&gt;string('action')-&gt;comment('\u30a2\u30af\u30b7\u30e7\u30f3');<\/strong>\r\n<strong>            $table-&gt;timestamps();<\/strong>\r\n\r\n<strong>            $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');<\/strong>\r\n<strong>        });<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Reverse the migrations.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function down(): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        Schema::dropIfExists('user_actions');<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>};<\/strong><\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067<code>DB<\/code>\u3092\u521d\u671f\u5316\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12597\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_2.png\" alt=\"\" width=\"372\" height=\"261\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_2.png 372w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_2-300x210.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/p>\n<\/div>\n<\/div>\n<h1>\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:controller WebBeaconController<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4f5c\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<p><strong>app\/Http\/Controllers\/WebBeaconController.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\\Models\\User;<\/strong>\r\n<strong>use App\\Models\\UserAction;<\/strong>\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n\r\n<strong>class WebBeaconController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function image(Request $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $user_id = (int) $request-&gt;cookie('user_id');<\/strong>\r\n\r\n<strong>        if($user_id &gt; 0) {<\/strong>\r\n\r\n<strong>            $user = User::find($user_id);<\/strong>\r\n<strong>            $actions = $request-&gt;input('actions', []);<\/strong>\r\n\r\n<strong>            foreach ($actions as $action) {<\/strong>\r\n\r\n<strong>                $user_action = new UserAction();<\/strong>\r\n<strong>                $user_action-&gt;user_id = $user-&gt;id;<\/strong>\r\n<strong>                $user_action-&gt;action = $action;<\/strong>\r\n<strong>                $user_action-&gt;save(); \/\/ \u30e6\u30fc\u30b6\u30fc\u306e\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58<\/strong>\r\n\r\n<strong>                logger($user-&gt;name .'\u3055\u3093\u306e\u884c\u52d5\u5c65\u6b74\u300c'. $action . '\u300d \u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01');<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $image_path = public_path('images\/profile.png');<\/strong>\r\n\r\n<strong>        return response()-&gt;file($image_path);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function test(Request $request) \/\/ \u30c6\u30b9\u30c8\u7528\u306b Cookie \u3092\u30bb\u30c3\u30c8\u3059\u308b<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        \/\/ \u30ed\u30b0\u30a4\u30f3\u3057\u305f\u3068\u304d\u3092\u60f3\u5b9a<\/strong>\r\n\r\n<strong>        $user = User::first();<\/strong>\r\n<strong>        $user_id = $user-&gt;id;<\/strong>\r\n<strong>        $minutes = 60 * 24 * 365 * 10; \/\/ 10\u5e74\u9593<\/strong>\r\n<strong>        $same_site = 'None'; \/\/ \u3053\u3053\u304c\u30dd\u30a4\u30f3\u30c8<\/strong>\r\n<strong>        $cookie = cookie(<\/strong>\r\n<strong>            name: 'user_id',<\/strong>\r\n<strong>            value: $user_id,<\/strong>\r\n<strong>            minutes: $minutes,<\/strong>\r\n<strong>            sameSite: $same_site,<\/strong>\r\n<strong>        );<\/strong>\r\n\r\n<strong>        return response('Cookie \u304c\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3057\u305f\uff01')-&gt;cookie($cookie);<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p>\u3053\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u4e2d\u306b\u306f\u30c6\u30b9\u30c8\u7528\u306e<code>test()<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u30b3\u30fc\u30c9\u304c\u3081\u3093\u3069\u3046\u306a\u306e\u3067\u3001\u3053\u3053\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3089\u81ea\u52d5\u3067<code>Cookie<\/code>\u300c<strong>user_id<\/strong>\u300d\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u3053\u304c\u91cd\u8981\u306a\u306e\u3067\u3059\u304c\u3001\u30bb\u30c3\u30c8\u3059\u308b\u30af\u30c3\u30ad\u30fc\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u300c<strong>sameSite<\/strong>\u300d\u304c\u300c<strong>None<\/strong>\u300d\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001<strong>\u5225\u30c9\u30e1\u30a4\u30f3\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3067\u3082 Cookie \u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/strong>\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u306f\u753b\u50cf\u306a\u306e\u3067\u691c\u8a3c\u3059\u308b\u306e\u304c\u3081\u3093\u3069\u3046\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001<code>logger()<\/code>\u3092\u4f7f\u3063\u3066\u30ed\u30b0\u306b\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u304c\u3069\u3046\u306a\u308b\u304b\u3092\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3067\u3059\u3002<\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>use Illuminate\\Support\\Facades\\Route;<\/strong>\r\n<strong>use App\\Http\\Controllers\\WebBeaconController;<\/strong>\r\n\r\n<strong>Route::get('profile_image', [WebBeaconController::class, 'image']);<\/strong>\r\n<strong>Route::get('profile_image\/test', [WebBeaconController::class, 'test']);<\/strong><\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5168\u3066\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\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\u524d\u63d0\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30b5\u30a4\u30c8 A\uff1a \u4eca\u56de\u4f5c\u3063\u305f\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b\u30b5\u30a4\u30c8<\/li>\n<li>\u30b5\u30a4\u30c8 B\uff1a \u30b5\u30a4\u30c8 A \u306e\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u30b5\u30a4\u30c8<\/li>\n<\/ul>\n<p>\u3064\u307e\u308a\u3001\u30b5\u30a4\u30c8 B \u3067\u753b\u50cf\u3092\u8868\u793a\u3057\u305f\u3068\u304d\u306b\u3001\u30b5\u30a4\u30c8 A \u3067\u30e6\u30fc\u30b6\u30fc\u884c\u52d5\u5c65\u6b74\u304c\u4fdd\u5b58\u3055\u308c\u305f\u3089\u6210\u529f\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u30c6\u30b9\u30c8\u7528\u306e\u30eb\u30fc\u30c8\u300c<strong>https:\/\/******\/profile_image\/test<\/strong>\u300d\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/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-12596\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_3.png\" alt=\"\" width=\"227\" height=\"43\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u8868\u793a\u304c\u8fd4\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u958b\u767a\u30c4\u30fc\u30eb\u3092\u4f7f\u3063\u3066<code>Cookie<\/code>\u304c<br \/>\n\u3061\u3083\u3093\u3068\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12595\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_4.png\" alt=\"\" width=\"463\" height=\"142\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_4.png 463w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_4-300x92.png 300w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/p>\n<p>\u3061\u3083\u3093\u3068\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306b\u30c9\u30e1\u30a4\u30f3\u304c\u9055\u3046\u300c<strong>\u30b5\u30a4\u30c8B<\/strong>\u300d\u3067\u4ee5\u4e0b\u306eHTML\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<div>\n<pre><strong>&lt;img src=\"https:\/\/******\/profile_image?actions[]=marketing&amp;actions[]=management\"&gt;<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001\u3053\u306e\u4e2d\u306e<code>actions[]=*****<\/code>\u3068\u3044\u3046\u90e8\u5206\u304c\u5b9f\u969b\u306b\u4fdd\u5b58\u3055\u308c\u308b\u5024\u306b\u306a\u308a\u307e\u3059<\/p>\n<\/div>\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-12594\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_5.png\" alt=\"\" width=\"271\" height=\"267\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_5.png 271w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_5-100x100.png 100w\" sizes=\"auto, (max-width: 271px) 100vw, 271px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u884c\u52d5\u5c65\u6b74\u304c\u6b8b\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12593\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_6.png\" alt=\"\" width=\"532\" height=\"300\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_6.png 532w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/03\/laravel_web_beacon_marketing_6-300x169.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u30e6\u30fc\u30b6\u30fcID\u304c<code>1<\/code>\u306e\u4eba\u306b\u300c<strong>marketing<\/strong>\u300d\u3068\u300c<strong>management<\/strong>\u300d\u306e\u884c\u52d5\u5c65\u6b74\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3053\u308c\u306f\u3001\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3092\u547c\u3073\u51fa\u3059<code>URL<\/code>\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5909\u66f4\u3059\u308c\u3070\u300c<b>bag<\/b>\u300d\u3084\u300c<strong>coffee<\/strong>\u300d\u300c<strong>investment<\/strong>\u300d\u306a\u3069\u306a\u3093\u3067\u3082\u5024\u3092\u5909\u66f4\u3067\u304d\u3001\u7d50\u679c<strong>\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u3069\u3093\u306a\u3053\u3068\u306b\u8208\u5473\u304c\u3042\u308b\u306e\u304b\u304c\u5206\u304b\u308b<\/strong>\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>\u901a\u5e38\u3001\u30e6\u30fc\u30b6\u30fc\u884c\u52d5\u5c65\u6b74\u306f\u7279\u5b9a\u306e\u30b5\u30a4\u30c8\u3060\u3051\u3067\u7ba1\u7406\u3057\u3066\u3044\u308b\u5834\u5408\u304c\u591a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u4eca\u56de\u306e\u6280\u8853\u3092\u4f7f\u3048\u3070\u3001\uff08\u305f\u3068\u3048\u30c9\u30e1\u30a4\u30f3\u304c\u9055\u3063\u305f\u3068\u3057\u3066\u3082\uff09<strong>\u59c9\u59b9\u30b5\u30a4\u30c8\u3084\u30d6\u30ed\u30b0\u3001\u5354\u529b\u4f1a\u793e\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u304b\u3089\u3067\u3082\u30e6\u30fc\u30b6\u30fc\u884c\u52d5\u5c65\u6b74\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/p>\n<p>\u305d\u3057\u3066\u3001\u3088\u308a\u591a\u304f\u306e\u30c7\u30fc\u30bf\u304c\u96c6\u307e\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u7279\u5b9a\u306e\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u3067\u306a\u304f\u3001\u9867\u5ba2\u306e\u50be\u5411\u3092\u3088\u308a\u6b63\u78ba\u306b\u3064\u304b\u3081\u308b\u3068\u3044\u3046\u3053\u3068\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u300c<strong>\u3088\u308a\u7cbe\u5ea6\u306e\u9ad8\u3044\u9867\u5ba2\u7406\u89e3<\/strong>\u300d\u3092\u304a\u6c42\u3081\u3067\u3057\u305f\u3089\u3001\u305c\u3072\u304a\u6c17\u8efd\u306b\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\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u30a6\u30a7\u30d6\u30d3\u30fc\u30b3\u30f3\u3092\u3064\u304b\u3063\u3066\u30e6\u30fc\u30b6\u30fc\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58\u3057\u3001\u305d\u308c\u3092\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306b\u6d3b\u7528\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u3053\u3046\u8003\u3048\u308b\u3068\u3084\u306f\u308a\u6211\u3005\u306e\u884c\u52d5\u30c7\u30fc\u30bf\u306f\u3059\u3067\u306b\u591a\u304f\u306e\u30b5\u30a4\u30c8\u3067\u53d6\u3089\u308c\u3066\u3044\u308b\u3068\u8003\u3048\u305f\u65b9\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u4ee5\u524d\u3001\u5225\u30b5\u30a4\u30c8\u3067\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u9001\u4fe1\u3057\u305f\u3042\u3068\u3001\u305d\u3053\u3068\u306f\u5225\u306e\u30d6\u30ed\u30b0\u3092\u898b\u306b\u884c\u3063\u305f\u6642\u306b\u3001\u305d\u306e\u30d6\u30ed\u30b0\u8a18\u4e8b\u306b\u95a2\u9023\u3059\u308b\u5546\u54c1\u306e\u300c\u5272\u5f15\u30af\u30fc\u30dd\u30f3\u300d\u304c\u30e1\u30fc\u30eb\u3067\u5c4a\u3044\u305f\u3053\u3068\u304c\u3042\u308a\u9a5a\u304d\u307e\u3057\u305f\u304c\u3001\u3053\u3046\u3044\u3046\u4ed5\u7d44\u307f\u3060\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u30de\u30fc\u30b1\u30bf\u30fc\u3063\u3066\u8ce2\u3044\u4eba\u304c\u591a\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u300c\u30d7\u30ed\u30b0\u30e9\u30e0 x \u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u300d\u3067\u300c\u7a3c\u3050\u30b3\u30fc\u30c9\u300d\u3092\u3064\u304f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\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-6071 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u795e\u6238\u306e\u30c7\u30b6\u30a4\u30f3\u30de\u30f3\u30db\u30fc\u30eb<br \/>\n24\u7a2e\u985e<br \/>\n\u30b3\u30f3\u30d7\u30ea\u30fc\u30c8\u3057\u307e\u3057\u305f\ud83d\ude0a\u2728\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u7a81\u7136\u3067\u3059\u304c\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u8d85\u30b7\u30f3\u30d7\u30eb\u306a \u6975\u610f\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb \u6b32\u3057\u304c\u3063\u3066\u308b\u4eba\u306b\u58f2\u308b \u3067\u3059\u3002 \u3064\u307e\u308a\u3001\u9b5a\u306b\u30d5\u30e9\u30a4\u30c9\u30c1\u30ad\u30f3\u3042\u3052\u3066\u3082\u98df\u3079\u306a\u3044 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=12583\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\uff1a\u5225\u30c9\u30e1\u30a4\u30f3\u304b\u3089\u3067\u3082\u884c\u52d5\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u6226\u7565&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":12600,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,258],"tags":[],"class_list":["post-12583","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\/12583","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=12583"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12583\/revisions"}],"predecessor-version":[{"id":12692,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12583\/revisions\/12692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/12600"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}