{"id":8403,"date":"2020-12-28T07:00:17","date_gmt":"2020-12-27T22:00:17","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=8403"},"modified":"2020-12-21T19:50:40","modified_gmt":"2020-12-21T10:50:40","slug":"laravel%e3%81%a7%e3%81%8a%e7%9f%a5%e3%82%89%e3%81%9b%e6%a9%9f%e8%83%bd%ef%bc%88%e6%9c%aa%e8%aa%ad%e6%a9%9f%e8%83%bd%e3%81%a4%e3%81%8d%ef%bc%89%e3%82%92%e3%81%a4%e3%81%8f%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=8403","title":{"rendered":"Laravel\u3067\u304a\u77e5\u3089\u305b\u6a5f\u80fd\uff08\u672a\u8aad\u6a5f\u80fd\u3064\u304d\uff09\u3092\u3064\u304f\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u3069\u306e\u30b5\u30a4\u30c8\u306b\u3082\u8a00\u3048\u308b\u3053\u3068\u3067\u3059\u304c\u3001\u30ea\u30ea\u30fc\u30b9\u3057\u3066\u304b\u3089\u3082\u6a5f\u80fd\u306e\u8ffd\u52a0\u3084\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u3046\u306a\u3063\u3066\u304f\u308b\u3068\uff08\u7279\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u3042\u308b\u30b5\u30a4\u30c8\u306b\uff09\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u3082\u306e\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u304a\u77e5\u3089\u305b\u6a5f\u80fd<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070<code>SNS<\/code>\u306b\u3042\u308b\u3001\u30da\u30fc\u30b8\u4e0a\u90e8\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u30a2\u30a4\u30b3\u30f3\u3092\u601d\u3044\u6d6e\u304b\u3079\u308b\u3068\u308f\u304b\u308a\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8404\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_1.png\" alt=\"\" width=\"516\" height=\"284\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_1.png 516w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_1-300x165.png 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><br \/>\n<small>\uff08\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306f <a href=\"https:\/\/adminlte.io\/themes\/v3\/\" target=\"_blank\" rel=\"noopener noreferrer\">AdminLte 3<\/a> \u3088\u308a\u5f15\u7528\uff09<\/small><\/p>\n<p>\u3053\u306e\u90e8\u5206\u306b\u3001\u4f8b\u3048\u3070\u300c<strong>\u65b0\u6a5f\u80fd\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f<\/strong> \ud83c\udf89\u300d\u306a\u3069\u306e\u30cb\u30e5\u30fc\u30b9\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u30e6\u30fc\u30b6\u30fc\u306b\u60c5\u5831\u3092\u77e5\u3063\u3066\u3082\u3089\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u3053\u306e\u300c<strong>\u304a\u77e5\u3089\u305b\u6a5f\u80fd<\/strong>\u300d\u3092<code>Laravel<\/code>\u3067\u5b9f\u88c5\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u5404\u304a\u77e5\u3089\u305b\u306b\u306f\u300c<strong>\u672a\u8aad or \u65e2\u8aad<\/strong>\u300d\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u3057\u3001\u300c<strong>\u3069\u308c\u304c\u672a\u8aad\u306e\u304a\u77e5\u3089\u305b\u306a\u306e\u304b\uff1f<\/strong>\u300d\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3001\u958b\u767a\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<br \/>\n\uff08\u6700\u5f8c\u306b\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3088\ud83d\udc4d\uff09<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u69d8\u304b\u3089\u306e\u304a\u6b73\u66ae\u3067\u3001<br \/>\n\u512a\u96c5\u306a\u3072\u3068\u6642\u3092\u904e\u3054\u3057\u3066\u307e\u3059\ud83d\ude0a\u2728\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 8.x\u3001Boostrap 4\u3001axios 0.19<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u5192\u982d\u3067\u3082\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u672a\u8aad\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u304c\u5fc5\u8981\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u3059\u3067\u306b<code>Laravel 8.x<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u307e\u3060\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u306a\u3044\u65b9\u306f\u3001\u4ee5\u4e0b\u3044\u305a\u308c\u304b\u3092\u53c2\u8003\u306b\u3057\u3066\u5b9f\u88c5\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=7827\">Laravel8.x\u4ee5\u964d\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=8301\">Laravel Breeze\u3067\u300c\u30b7\u30f3\u30d7\u30eb\u306a\u300d\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u697d\u3057\u304f\u5b9f\u969b\u306e\u4f5c\u696d\u3092\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\uff06\u30e2\u30c7\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305a\u306f\u3001\u304a\u77e5\u3089\u305b\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308a\u307e\u3059\u306e\u3067\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u30e2\u30c7\u30eb\u3092\u3064\u304f\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:model Announcement -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_announcements_table.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up()\r\n{\r\n    <strong>Schema::create('announcements', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('title')-&gt;comment('\u304a\u77e5\u3089\u305b\uff1a\u30bf\u30a4\u30c8\u30eb');<\/strong>\r\n<strong>        $table-&gt;text('description')-&gt;comment('\u304a\u77e5\u3089\u305b\uff1a\u5185\u5bb9');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u3001<code>Announcement<\/code>\u30e2\u30c7\u30eb\u306b\u300c<strong>\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7<\/strong>\u300d\u3068\u300c<strong>Accessor<\/strong>\u300d\u3092\u8ffd\u52a0\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>app\/Models\/Announcement.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Announcement extends Model\r\n{\r\n    use HasFactory;\r\n\r\n    <strong>protected $appends = ['url', 'date'];<\/strong>\r\n\r\n<strong>    \/\/ Relationship<\/strong>\r\n<strong>    public function reads() {<\/strong>\r\n\r\n<strong>        return $this-&gt;hasMany(AnnouncementRead::class, 'announcement_id', 'id');<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/\/ Accessor<\/strong>\r\n<strong>    public function getUrlAttribute() {<\/strong>\r\n\r\n<strong>        return route('announcement.show', $this-&gt;id);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function getDateAttribute() {<\/strong>\r\n\r\n<strong>        return $this-&gt;created_at-&gt;format('m\u6708d\u65e5');<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u203b <code>Accessor<\/code>\u306e\u8a73\u3057\u3044\u8aac\u660e\u306f\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=1241\">\u516815\u4ef6\uff01Laravel\u30fb\u4f7f\u3044\u56de\u3057\u3067\u304d\u308bAccessor\u5b9f\u4f8b<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u7d9a\u3044\u3066\u3082\u3046\u4e00\u3064\u3001\u304a\u77e5\u3089\u305b\u306e\u300c<strong>\u672a\u8aad or \u65e2\u8aad<\/strong>\u300d\u3092\u7ba1\u7406\u3059\u308b\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\uff06\u30e2\u30c7\u30eb\u3082\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3064\u304f\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:model AnnouncementRead -m<\/strong><\/pre>\n<p>\u3053\u3061\u3089\u3082\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_announcement_reads_table.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up()\r\n{\r\n    <strong>Schema::create('announcement_reads', 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;unsignedBigInteger('announcement_id')-&gt;comment('\u304a\u77e5\u3089\u305bID');<\/strong>\r\n<strong>        $table-&gt;boolean('read')-&gt;default(false)-&gt;comment('\u672a\u8aad or \u65e2\u8aad');<\/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>        $table-&gt;foreign('announcement_id')-&gt;references('id')-&gt;on('announcements');<\/strong>\r\n<strong>    });<\/strong>\r\n}<\/pre>\n<h1>\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066<code>Seeder\u30d5\u30a1\u30a4\u30eb<\/code>\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:seed AnnouncementsTableSeeder<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>database\/seeders\/AnnouncementsTableSeeder.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function run()\r\n{\r\n    <strong>$user_ids = User::orderBy('id')-&gt;pluck('id');<\/strong>\r\n\r\n<strong>    for($i = 0 ; $i &lt; 25 ; $i++) {<\/strong>\r\n\r\n<strong>        $announcement = new Announcement();<\/strong>\r\n<strong>        $announcement-&gt;title = '\u30c6\u30b9\u30c8\u30bf\u30a4\u30c8\u30eb - '. $i;<\/strong>\r\n<strong>        $announcement-&gt;description = \"\u30c6\u30b9\u30c8\u304a\u77e5\u3089\u305b\\n\u30c6\u30b9\u30c8\u304a\u77e5\u3089\u305b\\n\u30c6\u30b9\u30c8\u304a\u77e5\u3089\u305b - \". $i;<\/strong>\r\n<strong>        $announcement-&gt;save();<\/strong>\r\n\r\n<strong>        foreach ($user_ids as $user_id) {<\/strong>\r\n\r\n<strong>            $read = new AnnouncementRead();<\/strong>\r\n<strong>            $read-&gt;user_id = $user_id;<\/strong>\r\n<strong>            $read-&gt;announcement_id = $announcement-&gt;id;<\/strong>\r\n<strong>            $read-&gt;save();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p><code>Seeder<\/code>\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3067\u304d\u305f\u3089\u3001<code>Laravel<\/code>\u3078\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<p><strong>database\/seeders\/DatabaseSeeder.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace Database\\Seeders;\r\n\r\nuse App\\Models\\Item;\r\nuse App\\Models\\Team;\r\nuse App\\Models\\User;\r\nuse App\\Models\\Address;\r\nuse Illuminate\\Database\\Seeder;\r\n\r\nclass DatabaseSeeder extends Seeder\r\n{\r\n    public function run()\r\n    {\r\n\/\/         User::factory(10)-&gt;create();\r\n        <strong>$this-&gt;call(AnnouncementsTableSeeder::class); \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n    }\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u3059\u308b\u3068DB\u30c6\u30fc\u30d6\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8406\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_2.png\" alt=\"\" width=\"640\" height=\"431\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_2-300x202.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8407\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_3.png\" alt=\"\" width=\"640\" height=\"396\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_3.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_3-300x186.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u3001\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre><strong>Route::prefix('announcement')-&gt;middleware('auth')-&gt;group(function(){<\/strong>\r\n\r\n<strong>    Route::get('\/', [AnnouncementController::class, 'index'])-&gt;name('announcement.index');<\/strong>\r\n<strong>    Route::get('\/list', [AnnouncementController::class, 'list'])-&gt;name('announcement.list');<\/strong>\r\n<strong>    Route::get('\/{announcement}', [AnnouncementController::class, 'show'])-&gt;name('announcement.show');<\/strong>\r\n\r\n<strong>});<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u306f\uff13\u3064\u306e\u30eb\u30fc\u30c8\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\uff11\u3064\u76ee\u304c\u3001\u30da\u30fc\u30b8\u4e0a\u90e8\u306b\u304a\u77e5\u3089\u305b\u3092\u8868\u793a\u3059\u308b\u30da\u30fc\u30b8\u3067\u3059\u3002<br \/>\n\u306a\u304a\u3001\u304a\u77e5\u3089\u305b\u60c5\u5831\u306f\u5168\u30da\u30fc\u30b8\u3067\u8868\u793a\u3055\u308c\u308b\u3079\u304d\u306a\u306e\u3067\u3001\u672c\u6765\u306f\u300c<strong>\/resources\/views\/layouts<\/strong>\u300d\u306e\u4e2d\u306b\u3044\u308c\u308b\u3079\u304d\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u306a\u306e\u3067\u3053\u306e\u30eb\u30fc\u30c8\u3060\u3051\u3067\u8868\u793a\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\uff12\u3064\u76ee\u304c\u3001\u672a\u8aad\u306e\u304a\u77e5\u3089\u305b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<br \/>\n\u3053\u308c\u306f<code>Ajax<\/code>\u3067\u306e\u53d6\u5f97\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u304a\u77e5\u3089\u305b\u306e\u8a73\u7d30\u30da\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001<code>auth<\/code>\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u3064\u3051\u3066\u3001\u30ed\u30b0\u30a4\u30f3\u3092\u5fc5\u9808\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:controller AnnouncementController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/AnnouncementController.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse App\\Models\\Announcement;\r\nuse App\\Models\\AnnouncementRead;\r\nuse Illuminate\\Http\\Request;\r\n\r\nclass AnnouncementController extends Controller\r\n{\r\n    <strong>public function index() {<\/strong>\r\n\r\n<strong>        return view('announcement.index');<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function show(Request $request, Announcement $announcement) {<\/strong>\r\n\r\n<strong>        $user = $request-&gt;user();<\/strong>\r\n<strong>        $announcement_read = AnnouncementRead::where('user_id', $user-&gt;id)<\/strong>\r\n<strong>            -&gt;where('announcement_id', $announcement-&gt;id)<\/strong>\r\n<strong>            -&gt;first();<\/strong>\r\n\r\n<strong>        if(!is_null($announcement_read)) {<\/strong>\r\n\r\n<strong>            $announcement_read-&gt;read = true;<\/strong>\r\n<strong>            $announcement_read-&gt;save();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return $announcement;<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function list(Request $request) {<\/strong>\r\n\r\n<strong>        $user = $request-&gt;user();<\/strong>\r\n<strong>        return Announcement::whereHas('reads', function($query) use($user){<\/strong>\r\n\r\n<strong>            $query-&gt;where('user_id', $user-&gt;id)<\/strong>\r\n<strong>                -&gt;where('read', false);<\/strong>\r\n\r\n<strong>        })<\/strong>\r\n<strong>        -&gt;orderBy('created_at', 'desc')<\/strong>\r\n<strong>        -&gt;orderBy('id', 'desc')<\/strong>\r\n<strong>        -&gt;paginate(7);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}\r\n<\/pre>\n<p>\u306a\u304a\u3001<code>list()<\/code>\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u304c<code>whereHas()<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u610f\u5473\u3068\u3057\u3066\u306f\u3001\u300c\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u5148\u3067\u7d5e\u308a\u8fbc\u307f\u3092\u3057\u305f\u30c7\u30fc\u30bf\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u300d\u3068\u306a\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u300c<strong>\u5404\u30e6\u30fc\u30b6\u30fc\u306e announcement_reads \u304c\u672a\u8aad\u306b\u306a\u3063\u3066\u3044\u308b\u3082\u306e\u3060\u3051<\/strong>\u300d\u3092\u30c7\u30fc\u30bf\u53d6\u5f97\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u307e\u305f\u3001<code>show()<\/code>\u30e1\u30bd\u30c3\u30c9\u306b\u3082\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u3053\u3053\u3067\u306f\u3001\u8868\u793a\u3057\u305f\u304a\u77e5\u3089\u305b\u306e\u300c<strong>\u672a\u8aad<\/strong>\u300d\u3092\u300c<strong>\u65e2\u8aad<\/strong>\u300d\u306b\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u4e00\u5ea6\u8868\u793a\u3057\u305f\u304a\u77e5\u3089\u305b\u30c7\u30fc\u30bf\u304c<strong>\u6b21\u56de\u304b\u3089\u672a\u8aad\u306b\u306f\u542b\u307e\u308c\u306a\u304f\u306a\u308b<\/strong>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u5148\u307b\u3069\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u30bb\u30c3\u30c8\u3057\u305f\u30d3\u30e5\u30fc\u30fb\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u300c<strong>\u4f7f\u3044\u56de\u3057<\/strong>\u300d\u304c\u3067\u304d\u308b\u3088\u3046\u3001<code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/announcement\/index.blade.php<\/strong><\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/5.15.1\/css\/all.min.css\"&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.0\/css\/bootstrap.min.css\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;div id=\"app\"&gt;\r\n    &lt;nav class=\"navbar navbar-expand-lg navbar-light bg-light\"&gt;\r\n        \u304a\u77e5\u3089\u305b\u6a5f\u80fd\u30b5\u30f3\u30d7\u30eb\r\n        &lt;div class=\"collapse navbar-collapse\"&gt;\r\n            &lt;ul class=\"navbar-nav ml-auto\"&gt;\r\n\r\n                <strong>&lt;!-- \u2462 \u72ec\u81ea\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u8868\u793a --&gt;<\/strong>\r\n<strong>                &lt;v-dropdown-nav-item v-model:items=\"announcements\"&gt;<\/strong>\r\n\r\n<strong>                    &lt;!-- \u8868\u793a\u3059\u308b\u30a2\u30a4\u30b3\u30f3 --&gt;<\/strong>\r\n<strong>                    &lt;i class=\"far fa-bell\"&gt;&lt;\/i&gt;<\/strong>\r\n\r\n<strong>                    &lt;!-- \u30d5\u30c3\u30bf\u30fc\u306f\u4efb\u610f\u3067\u3059 --&gt;<\/strong>\r\n<strong>                    &lt;template v-slot:footer&gt;<\/strong>\r\n<strong>                        &lt;div class=\"dropdown-divider\"&gt;&lt;\/div&gt;<\/strong>\r\n<strong>                        &lt;a class=\"dropdown-item text-center text-secondary\" href=\"#\"&gt;<\/strong>\r\n<strong>                            &lt;small&gt;\u5168\u3066\u306e\u304a\u77e5\u3089\u305b\u3092\u898b\u308b&lt;\/small&gt;<\/strong>\r\n<strong>                        &lt;\/a&gt;<\/strong>\r\n<strong>                    &lt;\/template&gt;<\/strong>\r\n\r\n<strong>                &lt;\/v-dropdown-nav-item&gt;<\/strong>\r\n\r\n            &lt;\/ul&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/nav&gt;\r\n&lt;\/div&gt;\r\n&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.5.1.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.0\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/unpkg.com\/vue@3.0.2\/dist\/vue.global.prod.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.19.2\/axios.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\n\r\n    <strong>\/\/ \u2460 \u30c9\u30ed\u30c3\u30d7\u30c0\u30a6\u30f3\u3092\u8868\u793a\u3059\u308bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5b9a\u7fa9<\/strong>\r\n<strong>    const dropdownNavItemComponent = {<\/strong>\r\n<strong>        props: ['items'],<\/strong>\r\n<strong>        computed: {<\/strong>\r\n<strong>            hasItem() {<\/strong>\r\n\r\n<strong>                return (<\/strong>\r\n<strong>                    Object.keys(this.items).length &gt; 0 &amp;&amp;<\/strong>\r\n<strong>                    this.items.data.length &gt; 0<\/strong>\r\n<strong>                );<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n<strong>        },<\/strong>\r\n<strong>        template: `<\/strong>\r\n<strong>            &lt;li class=\"nav-item dropdown\" v-if=\"hasItem\"&gt;<\/strong>\r\n<strong>                &lt;a style=\"position:relative;min-width:40px;\" class=\"nav-link\" data-toggle=\"dropdown\" href=\"#\"&gt;<\/strong>\r\n<strong>                    &lt;slot&gt;<\/strong>\r\n<strong>                        &lt;i class=\"far fa-bell\"&gt;&lt;\/i&gt;<\/strong>\r\n<strong>                    &lt;\/slot&gt;<\/strong>\r\n<strong>                    &lt;span style=\"position:absolute;top:0;left:16px;\" class=\"badge badge-danger\" v-text=\"items.total\"&gt;&lt;\/span&gt;<\/strong>\r\n<strong>                &lt;\/a&gt;<\/strong>\r\n<strong>                &lt;div style=\"width:300px;\" class=\"dropdown-menu dropdown-menu-right\" aria-labelledby=\"navbarDropdown\"&gt;<\/strong>\r\n<strong>                    &lt;a style=\"overflow: hidden;text-overflow:ellipsis;\" class=\"dropdown-item\" :href=\"item.url\" v-for=\"item in items.data\"&gt;<\/strong>\r\n<strong>                        &lt;small class=\"float-right text-muted pl-3\" v-text=\"item.date\"&gt;&lt;\/small&gt;<\/strong>\r\n<strong>                        &lt;small v-text=\"item.title\"&gt;&lt;\/small&gt;<\/strong>\r\n<strong>                    &lt;\/a&gt;<\/strong>\r\n<strong>                    &lt;footer&gt;<\/strong>\r\n<strong>                        &lt;slot name=\"footer\"&gt;&lt;\/slot&gt;<\/strong>\r\n<strong>                    &lt;\/footer&gt;<\/strong>\r\n<strong>                &lt;\/div&gt;<\/strong>\r\n<strong>            &lt;\/li&gt;<\/strong>\r\n<strong>        `<\/strong>\r\n<strong>    };<\/strong>\r\n\r\n    Vue.createApp({\r\n        data() {\r\n            return {\r\n                announcements: {}\r\n            }\r\n        },\r\n        mounted() {\r\n\r\n            const url = '{{ route('announcement.list') }}';\r\n            axios.get(url)\r\n                .then(response =&gt; {\r\n\r\n                    this.announcements = response.data;\r\n\r\n                });\r\n\r\n        }\r\n    })\r\n    <strong>.component('v-dropdown-nav-item', dropdownNavItemComponent) \/\/ \u2461 \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30bb\u30c3\u30c8<\/strong>\r\n    .mount('#app');\r\n\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u5c11\u3057\u8907\u96d1\u306a\u306e\u3067\u3072\u3068\u3064\u305a\u3064\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>\u2460 \u30c9\u30ed\u30c3\u30d7\u30c0\u30a6\u30f3\u3092\u8868\u793a\u3059\u308bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5b9a\u7fa9<\/strong><\/p>\n<p>\u300c\u304a\u77e5\u3089\u305b\u30a2\u30a4\u30b3\u30f3\u300d\u3068\u305d\u306e\u5185\u5bb9\u3092\u8868\u793a\u3059\u308b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6a5f\u80fd\u3092\u3082\u3063\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8411\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4.png\" alt=\"\" width=\"329\" height=\"308\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4.png 329w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4-300x281.png 300w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/p>\n<p>\u3053\u3053\u3067\u91cd\u8981\u306a\u306e\u304c\u3053\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u3001\u300c<strong>Laravel \u306e paginate() \u3067\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b<\/strong>\u300d\u3068\u3044\u3046\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u306a\u305c\u306a\u3089\u3001\u3053\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u5fc5\u8981\u306b\u306a\u308b\u306e\u306f\u3001\u4ee5\u4e0b\uff12\u3064\u3060\u304b\u3089\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u6700\u65b0\u306e\u304a\u77e5\u3089\u305b\u60c5\u5831\uff08\u4eca\u56de\u306f\u6700\u5927\uff17\u4ef6\uff09<\/li>\n<li>\u300c\u5168\u3066\u306e\u300d\u672a\u8aad\u4ef6\u6570\uff08\uff17\u4ef6\u3092\u8d85\u3048\u308b\u3053\u3068\u304c\u3042\u308b\uff09<\/li>\n<\/ul>\n<p>\u3053\u308c\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f<code>paginate()<\/code>\u304c\u90fd\u5408\u304c\u3044\u3044\u305f\u3081\u3001\u3053\u306e\u5f62\u3092\u63a1\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u8868\u793a\u5185\u5bb9\u3092\u304a\u597d\u307f\u3067\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u300c<strong>\u30b9\u30ed\u30c3\u30c8<\/strong>\u300d\u3092\u3064\u304f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u30e1\u30a4\u30f3\u306e\u30b9\u30ed\u30c3\u30c8\u306f\u30a2\u30a4\u30b3\u30f3\u3092\u5165\u308c\u304b\u3048\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8412\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_5.png\" alt=\"\" width=\"52\" height=\"41\" \/><\/p>\n<p>\u3064\u307e\u308a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30bf\u30b0\u3067\u56f2\u307e\u308c\u305f\u90e8\u5206\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u30a2\u30a4\u30b3\u30f3\u304c\u5909\u66f4\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;v-dropdown-nav-item v-model:items=\"announcements\"&gt;\r\n    <strong>&lt;i class=\"far fa-envelope\"&gt;&lt;\/i&gt;<\/strong>\r\n&lt;\/v-dropdown-nav-item&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8413\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_6.png\" alt=\"\" width=\"48\" height=\"39\" \/><\/p>\n<p>\u203b \u306a\u304a\u3001\u7701\u7565\u3059\u308b\u3068\u30d9\u30eb\u306e\u30de\u30fc\u30af\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u300c<strong>\u540d\u524d\u3064\u304d\u30b9\u30ed\u30c3\u30c8<\/strong>\u300d\u3082\u30d5\u30c3\u30bf\u30fc\u3068\u3057\u3066\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30d5\u30c3\u30bf\u30fc\u90e8\u5206\u306f\u3001\u4ee5\u4e0b\u306e\u90e8\u5206\u3092\u304a\u597d\u307f\u3067\u5165\u308c\u304b\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u3053\u3061\u3089\u306f\u3001\u7701\u7565\u3059\u308b\u3068\u4f55\u3082\u8868\u793a\u3055\u308c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;slot name=\"footer\"&gt;&lt;\/slot&gt;<\/strong><\/pre>\n<p>\u4f7f\u3044\u65b9\u306f\u3001\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<pre>&lt;v-dropdown-nav-item v-model:items=\"announcements\"&gt;\r\n\r\n    &lt;!-- \u7701\u7565 --&gt;\r\n\r\n    &lt;!-- \ud83d\udc47 \u3053\u3053\u306e\u90e8\u5206\u304c\u30d5\u30c3\u30bf\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u307e\u3059 --&gt;\r\n    <strong>&lt;template v-slot:footer&gt;<\/strong>\r\n<strong>        &lt;div class=\"dropdown-divider\"&gt;&lt;\/div&gt;<\/strong>\r\n<strong>        &lt;a class=\"dropdown-item text-center text-secondary\" href=\"#\"&gt;<\/strong>\r\n<strong>            &lt;small&gt;\u5168\u3066\u306e\u304a\u77e5\u3089\u305b\u3092\u898b\u308b&lt;\/small&gt;<\/strong>\r\n<strong>        &lt;\/a&gt;<\/strong>\r\n<strong>    &lt;\/template&gt;<\/strong>\r\n\r\n&lt;\/v-dropdown-nav-item&gt;<\/pre>\n<p><strong>\u2461 \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30bb\u30c3\u30c8<\/strong><\/p>\n<p>\u6b21\u306b <strong>\u2460<\/strong> \u3067\u4f5c\u3063\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092<code>Vue<\/code>\u306b\u30bb\u30c3\u30c8\u3057\u3066\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u66f8\u304d\u65b9\u306f<code>Vue 3<\/code>\u304b\u3089\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<p><strong>\u2462 \u72ec\u81ea\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u8868\u793a<\/strong><\/p>\n<p>\u6700\u5f8c\u306b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u304c\u3001<code>v-model:items<\/code>\u306b\u30bb\u30c3\u30c8\u3057\u3066\u3044\u308b<code>announcements<\/code>\u306f\u3001<code>mounted()<\/code>\u306e\u4e2d\u3067<code>Ajax\u901a\u4fe1<\/code>\u3067\u53d6\u5f97\u3057\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u304a\u307e\u3051\uff1a\u672a\u8aad\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b\u305f\u3081\u306b<\/h1>\n<p>\u4eca\u56de\u306f\u5168\u30e6\u30fc\u30b6\u30fc\u306e\u672a\u8aad\u30c7\u30fc\u30bf\uff08<strong>announcement_reads\u30c6\u30fc\u30d6\u30eb<\/strong>\uff09\u306f\u4e00\u6c17\u306b\u3064\u304f\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u4e00\u5ea6\u306b\u5927\u91cf\u306b\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u3001\u3082\u3057\u9014\u4e2d\u3067\u4f55\u304b\u4e0d\u5177\u5408\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3063\u305f\u3089\u3001\u30c7\u30fc\u30bf\u306e\u6574\u5408\u6027\u304c\u304a\u304b\u3057\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\uff08\u7279\u306b\u767b\u9332\u30e6\u30fc\u30b6\u30fc\u304c\u5897\u3048\u3066\u304f\u308b\u3068\u305d\u306e\u53ef\u80fd\u6027\u306f\u9ad8\u304f\u306a\u3063\u3066\u304d\u307e\u3059\uff09<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u306e\u89e3\u6c7a\u7b56\u3068\u3057\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3068\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<ol>\n<li>\u30e6\u30fc\u30b6\u30fc\u3054\u3068\u306b\u300c\u6700\u5f8c\u306b\u304a\u77e5\u3089\u305b\u60c5\u5831\u3092\u66f4\u65b0\u3057\u305f\u65e5\u6642\u300d\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f<\/li>\n<li>Ajax\u901a\u4fe1\u3067\u300c\u304a\u77e5\u3089\u305b\u30c7\u30fc\u30bf\u300d\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u3001\u3082\u3057\u4e00\u5b9a\u671f\u9593\uff08\u4f8b\u3048\u3070\u300124\u6642\u9593\uff09\u3092\u8d85\u3048\u3066\u3044\u308b\u5834\u5408\u306f\u672a\u8aad\u30c7\u30fc\u30bf\u3092\u30c1\u30a7\u30c3\u30af\u3057\u8ffd\u52a0\u3059\u308b<\/li>\n<li>\u3059\u308b\u3068\u3001\u6700\u65b0\u306e\u304a\u77e5\u3089\u305b\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<\/ol>\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\u3002<\/p>\n<p>\u307e\u305a\u306f\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u3066\u3001\u300c<strong>http:\/\/******\/announcement<\/strong>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p>\u3059\u308b\u3068\u3001\u30a2\u30a4\u30b3\u30f3\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u30af\u30ea\u30c3\u30af\u3057\u300c\u304a\u77e5\u3089\u305b\u300d\u306e\u4e2d\u8eab\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8411\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4.png\" alt=\"\" width=\"329\" height=\"308\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4.png 329w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_4-300x281.png 300w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u300c<strong>\u672a\u8aad<\/strong>\u300d\u304c\u300c<strong>\u65e2\u8aad<\/strong>\u300d\u306b\u306a\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u305f\u3081\u306b\u3001\u300c<strong>\u30c6\u30b9\u30c8\u30bf\u30a4\u30c8\u30eb &#8211; 21<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\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-8414\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_7.png\" alt=\"\" width=\"416\" height=\"76\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_7.png 416w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_7-300x55.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002\uff08\u30c6\u30b9\u30c8\u3067\u3059\u306e\u3067\u3001\u3053\u306e<code>JSON\u5f62\u5f0f<\/code>\u3067\u3059\u304c\u3001\u5b9f\u969b\u306f<code>return view('****');<\/code>\u306a\u3069\u3067\u8868\u793a\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u306e\u30da\u30fc\u30b8\u306b\u623b\u3063\u3066\u30ea\u30ed\u30fc\u30c9\u3057\u3001\u300c<strong>\u30c6\u30b9\u30c8\u30bf\u30a4\u30c8\u30eb &#8211; 21<\/strong>\u300d\u304c\u6d88\u3048\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\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-8415\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/12\/laravel_announcement_8.png\" alt=\"\" width=\"327\" height=\"306\" \/><\/p>\n<p>\u306f\u3044\u2757\u300c<strong>\u30c6\u30b9\u30c8\u30bf\u30a4\u30c8\u30eb &#8211; 21<\/strong>\u300d\u304c\u6d88\u3048\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u3001\u672a\u8aad\u4ef6\u6570\u304c<code>25<\/code>\u304b\u3089<code>24<\/code>\u306b\u6e1b\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=8424&amp;tmstv=1777654376\" rel=\"nofollow\" id=\"download-link-8424\" data-redirect=\"false\" >\n\tLaravel\u3067\u304a\u77e5\u3089\u305b\u6a5f\u80fd\uff08\u672a\u8aad\u6a5f\u80fd\u3064\u304d\uff09\u3092\u3064\u304f\u308b<\/a>\n\n<p>\u203b \u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u7b49\u306f\u3054\u81ea\u8eab\u3067\u884c\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel + Vue<\/code>\u3067\u300c<strong>\u304a\u77e5\u3089\u305b\u6a5f\u80fd<\/strong>\u300d\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u6a5f\u80fd\u3092\u3064\u304b\u3048\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u65b0\u7740\u306b\u3082\u3064\u304b\u3048\u308b\u3067\u3057\u3087\u3046\u3057\u3001\u306a\u3093\u306a\u3089\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u306e\u901a\u77e5\u3082\u53ef\u80fd\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001<code>SNS<\/code>\u3067\u7d4c\u9a13\u304c\u3042\u308b\u65b9\u3082\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u79c1\u306e\u5834\u5408\u3001\u30af\u30ea\u30c3\u30af\u3057\u3066\u672a\u8aad\u304c\u6d88\u3048\u308b\u3068\u306a\u305c\u304b\u5b09\u3057\u3044\u3068\u3044\u3046\u611f\u899a\u304c\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u304b\u3059\u308b\u3068\u3001\u3088\u308a\u672a\u8aad\u3092\u306a\u304f\u3059\u305f\u3081\u306b\u305d\u3046\u3044\u3063\u305f\u4f5c\u6226\u304c\u3042\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u3044\u308d\u3044\u308d\u3068\u5fdc\u7528\u3057\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-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\u5e74\u8cc0\u72b6\u306f\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3084SNS\u3067<br \/>\n\u6295\u7a3f\u3059\u308b\u30b9\u30bf\u30a4\u30eb\u3067\u3059\ud83d\udc4d\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u3069\u306e\u30b5\u30a4\u30c8\u306b\u3082\u8a00\u3048\u308b\u3053\u3068\u3067\u3059\u304c\u3001\u30ea\u30ea\u30fc\u30b9\u3057\u3066\u304b\u3089\u3082\u6a5f\u80fd\u306e\u8ffd\u52a0\u3084\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u305d\u3057\u3066\u3001\u305d\u3046\u306a\u3063\u3066\u304f\u308b\u3068\uff08\u7279\u306b\u30ed\u30b0\u30a4\u30f3 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=8403\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u3067\u304a\u77e5\u3089\u305b\u6a5f\u80fd\uff08\u672a\u8aad\u6a5f\u80fd\u3064\u304d\uff09\u3092\u3064\u304f\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":8418,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12],"tags":[],"class_list":["post-8403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-vue-js"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8403","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=8403"}],"version-history":[{"count":9,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8403\/revisions"}],"predecessor-version":[{"id":8429,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8403\/revisions\/8429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/8418"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}