{"id":8622,"date":"2021-02-15T07:00:57","date_gmt":"2021-02-14T22:00:57","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=8622"},"modified":"2021-02-05T01:43:15","modified_gmt":"2021-02-04T16:43:15","slug":"%e3%80%90laravel%e3%80%91%e8%bf%bd%e5%8a%a0%e3%83%bb%e5%a4%89%e6%9b%b4%e3%83%bb%e5%89%8a%e9%99%a4%e3%83%bb%e9%96%b2%e8%a6%a7%e3%81%97%e3%81%9f%e4%ba%ba%e3%81%ae%e5%b1%a5%e6%ad%b4%e3%82%92%e8%87%aa","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=8622","title":{"rendered":"\u3010Laravel\u3011\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u3057\u305f\u4eba\u306e\u5c65\u6b74\u3092\u81ea\u52d5\u3067\u4fdd\u5b58\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u5e78\u904b\u306b\u3082\u9577\u3089\u304f\u958b\u767a\u306e\u304a\u4ed5\u4e8b\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u4e2d\u306b\u306f\u3001\u300c<strong>\u305d\u308c\u307b\u3069\u9700\u8981\u304c\u591a\u3044\u308f\u3051\u3067\u306f\u306a\u3044\u3051\u3069\u3001\u305f\u307e\u306b\u6b32\u3057\u3044<\/strong>\u300d\u3068\u8a00\u308f\u308c\u308b\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u30c7\u30fc\u30bf\u64cd\u4f5c\u3057\u305f\u4eba\u306e\u60c5\u5831\u3092\u5c65\u6b74\u3068\u3057\u3066\u6b8b\u3057\u3066\u304a\u304f\u6a5f\u80fd<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3054\u4f9d\u983c\u3092\u3044\u305f\u3060\u3044\u305f\u30b1\u30fc\u30b9\u3067\u306f\u3001\u300c<strong>\u8ab0\u304c\u305d\u306e\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3057\u305f\u306e\u304b<\/strong>\u300d\u304c\u5206\u304b\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u3001\u4f7f\u3046\u4eba\u9593\u306b\u7dca\u5f35\u611f\u3092\u3082\u3063\u3066\u3082\u3089\u3046\u3053\u3068\u304c\u3067\u304d\u305f\u308a\u3001\u3082\u3057\u304f\u306f\u73cd\u3057\u3044\u30b1\u30fc\u30b9\u3067\u306f\u300c<strong>\u4e0d\u6b63\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3092\u3057\u305f\u3089\u3059\u3050\u30d0\u30ec\u308b\u304b\u3089\u3084\u3081\u3068\u3053<\/strong>\u300d\u3068\u306a\u308b\u3053\u3068\u304c\u76ee\u7684\u3067\u3057\u305f\u3002\uff08\u4f1a\u793e\u306b\u3088\u3063\u3066\u3001\u3044\u308d\u3093\u306a\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u306d\uff09<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p><span style=\"font-size: 1rem;\">\u4eca\u56de\u306f\u3053\u306e\u300c<\/span><strong style=\"font-size: 1rem;\">\u64cd\u4f5c\u3057\u305f\u4eba\u306e\u5c65\u6b74\u4fdd\u5b58<\/strong><span style=\"font-size: 1rem;\">\u300d\u3092<\/span><code>Laravel<\/code><span style=\"font-size: 1rem;\">\u3067\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3059\u3002<\/span><\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u305f\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<br \/>\n\uff08\u6700\u5f8c\u306e\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\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-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\u3053\u306e\u9593\u6559\u3048\u3066\u3082\u3089\u3063\u305f <a href=\"https:\/\/obniz.com\/ja\/\" target=\"_blank\" rel=\"noopener\">obniz<\/a> \u306b<br \/>\n\u8208\u5473\u6d25\u3005\u3067\u3059\u2757\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 8.x<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068\u306e\u8a73\u7d30<\/h1>\n<p>\u7279\u5b9a\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u4ee5\u4e0b\uff14\u3064\u306e\u51e6\u7406\u304c\u3042\u3063\u305f\u3089\u5c65\u6b74\u3092\u6b8b\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30c7\u30fc\u30bf\u8ffd\u52a0<\/li>\n<li>\u30c7\u30fc\u30bf\u5909\u66f4<\/li>\n<li>\u30c7\u30fc\u30bf\u524a\u9664<\/li>\n<li>\u30c7\u30fc\u30bf\u95b2\u89a7<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u3001\u4fdd\u5b58\u3059\u308b\u5c65\u6b74\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u306f\u4ee5\u4e0b\uff13\u3064\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u3044\u3064\uff1a \u64cd\u4f5c\u304c\u884c\u308f\u308c\u305f\u6642\u9593<\/li>\n<li>\u8ab0\u304c\uff1a \u30e6\u30fc\u30b6\u30fcID<\/li>\n<li>\u4f55\u3092\uff1a \u3069\u3053\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u3069\u306e\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3057\u305f\u304b<\/li>\n<\/ul>\n<p>\u306a\u304a\u3001\u305b\u3063\u304b\u304f\u4f5c\u308b\u306e\u3067\u3069\u3093\u306a\u30c6\u30fc\u30d6\u30eb\u3067\u3082\u6c4e\u7528\u7684\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u697d\u3057\u3093\u3067\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u3059\u3067\u306b<code>Laravel<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3001\u3055\u3089\u306b\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\u304c\u767b\u9332\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<\/p>\n<p>\u3082\u3057\u307e\u3060\u306e\u65b9\u306f\u4ee5\u4e0b\u306eURL\u3092\u53c2\u8003\u306b\u3057\u3066\u5148\u306b\u4f5c\u696d\u3092\u6e08\u307e\u305b\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003URL<\/strong><\/p>\n<ul>\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<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<\/ul>\n<h1>\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u300c<strong>\u3044\u3064\uff0f\u8ab0\u304c\uff0f\u4f55\u3092\u64cd\u4f5c\u3057\u305f\u304b<\/strong>\u300d\u304c\u308f\u304b\u308b\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\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<pre><strong>php artisan make:model ModelHistory -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u30e2\u30c7\u30eb\u304c\u4e00\u6c17\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up()\r\n{\r\n   <strong> Schema::create('model_histories', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('model')-&gt;comment('\u30e2\u30c7\u30eb\u540d');<\/strong>\r\n<strong>        $table-&gt;unsignedBigInteger('model_id')-&gt;comment('\u30e2\u30c7\u30eb\u306eID');<\/strong>\r\n<strong>        $table-&gt;unsignedBigInteger('user_id')-&gt;comment('\u64cd\u4f5c\u3057\u305f\u30e6\u30fc\u30b6\u30fc');<\/strong>\r\n<strong>        $table-&gt;string('operation_type')-&gt;comment('\u64cd\u4f5c\u306e\u30bf\u30a4\u30d7'); \/\/ created, updated, deleted, retrieved<\/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}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5909\u66f4\u304c\u3067\u304d\u305f\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u969b\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u5b8c\u4e86\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8623\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_1.png\" alt=\"\" width=\"405\" height=\"295\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_1.png 405w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_1-300x219.png 300w\" sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/p>\n<h1>Trait\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5c65\u6b74\u3092\u81ea\u52d5\u4fdd\u5b58\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u4f7f\u3044\u56de\u3057\u304c\u3057\u3084\u3059\u3044\u3088\u3046\u306b<code>Trait<\/code>\u3067\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>app\/Traits\/ModelHistoryTrait.php<\/strong><\/p>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Traits;<\/strong>\r\n\r\n<strong>use App\\Models\\ModelHistory;<\/strong>\r\n\r\n<strong>trait ModelHistoryTrait {<\/strong>\r\n\r\n<strong>    public static function saveModelHistory($types = ['created', 'updated', 'deleted', 'retrieved']) {<\/strong>\r\n\r\n<strong>        if(auth()-&gt;check()) {<\/strong>\r\n\r\n<strong>            foreach($types as $type) {<\/strong>\r\n\r\n<strong>                forward_static_call([__CLASS__, $type], function($model) use($type){<\/strong>\r\n\r\n<strong>                    $user = auth()-&gt;user();<\/strong>\r\n<strong>                    $history = new ModelHistory();<\/strong>\r\n<strong>                    $history-&gt;model = get_class($model);<\/strong>\r\n<strong>                    $history-&gt;model_id = $model-&gt;id;<\/strong>\r\n<strong>                    $history-&gt;user_id = $user-&gt;id;<\/strong>\r\n<strong>                    $history-&gt;operation_type = $type;<\/strong>\r\n<strong>                    $history-&gt;save();<\/strong>\r\n\r\n<strong>                });<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/\/ Relationship<\/strong>\r\n<strong>    public function model_histories() {<\/strong>\r\n\r\n<strong>        return $this-&gt;hasMany(ModelHistory::class, 'model_id', 'id')<\/strong>\r\n<strong>            -&gt;where('model', __CLASS__);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u5c11\u3057\u898b\u6163\u308c\u306a\u3044\u95a2\u6570<code>forward_static_call<\/code>\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u4ee5\u4e0b\uff14\u3064\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u7528\u610f\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<pre><strong>static::created(function($model){<\/strong>\r\n\r\n<strong>    \/\/<\/strong>\r\n\r\n<strong>});<\/strong>\r\n<strong>static::updated(function($model){<\/strong>\r\n\r\n<strong>    \/\/<\/strong>\r\n\r\n<strong>});<\/strong>\r\n<strong>static::deleted(function($model){<\/strong>\r\n\r\n<strong>    \/\/<\/strong>\r\n\r\n<strong>});\r\nstatic::retrieved(function($model){\r\n\r\n    \/\/\r\n\r\n});<\/strong><\/pre>\n<p>\u3064\u307e\u308a\u3001\u30eb\u30fc\u30d7\u3092\u4f7f\u3063\u3066<strong>\u52d5\u7684\u306b\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u3057\u3001\u7701\u30b3\u30fc\u30c9\u5316<\/strong>\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u305f\u3060\u3001\u304a\u305d\u3089\u304f\u79c1\u3082<code>forward_static_call()<\/code>\u3092\u4f7f\u3063\u305f\u306e\u306f\u521d\u3081\u3066\u3067\u3059\u3002\u3055\u3059\u304cPHP\u3002\u95a2\u6570\u304c\u8c4a\u3067\u3059\u306d\ud83d\ude02\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001<code>model_histories()<\/code>\u306f\u3001\u8a72\u5f53\u30c7\u30fc\u30bf\u306b\u95a2\u9023\u3059\u308b\u5168\u5c65\u6b74\u30c7\u30fc\u30bf\u3092\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u3067\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u6ce8\u76ee\u3057\u3066\u307b\u3057\u3044\u306e\u304c\u3001<code>where('model', __CLASS__)<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<strong>\u3053\u308c\u3092\u3064\u3051\u3066\u3044\u306a\u3044\u3068\u3001\u5225\u30e2\u30c7\u30eb\u306e\u540c\u3058ID\u3092\u6301\u3064\u30c7\u30fc\u30bf\u307e\u3067\u53d6\u5f97\u3057\u3066\u3057\u307e\u3046<\/strong>\u3053\u3068\u306b\u306a\u308b\u304b\u3089\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u30af\u30e9\u30b9\u540d\u3092\u4f7f\u3063\u3066\u7d5e\u308a\u8fbc\u307f\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u7528\u30e2\u30c7\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u306e\u6642\u70b9\u3067\u3059\u3067\u306b\u5c65\u6b74\u4fdd\u5b58\u7528\u306e\u30b3\u30fc\u30c9\u306f\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30c6\u30b9\u30c8\u7528\u306b<code>Song<\/code>\u3001\u305d\u3057\u3066<code>Book<\/code>\u3068\u3044\u3046\u30e2\u30c7\u30eb\u3068\u3001\u305d\u308c\u3089\u306b\u5bfe\u5fdc\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001\u307b\u307c\u540c\u3058\u5185\u5bb9\u3067\u3059\u306e\u3067\u3001\u4eca\u56de\u306f<code>Song<\/code>\u306e\u307f\u306e\u3054\u7d39\u4ecb\u3092\u3057\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<pre><strong>php artisan make:model Song -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u307e\u305a\u30e2\u30c7\u30eb\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>app\/Models\/Song.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\n<strong>use App\\Traits\\ModelHistoryTrait; \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Song extends Model\r\n{\r\n    use HasFactory, <strong>ModelHistoryTrait<\/strong>; <strong>\/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\n   <strong> public static function boot() \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\r\n    {\r\n        parent::boot();\r\n\r\n        self::saveModelHistory();\r\n    }<\/strong>\r\n}<\/pre>\n<p>\u7d9a\u3044\u3066\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002\uff08\u8ffd\u52a0\u3059\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u304a\u597d\u307f\u3067\u81ea\u7531\u306b\u5909\u66f4\u3057\u3066\u3082OK\u3067\u3059\ud83d\udc4d\uff09<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_songs_table.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up()\r\n{\r\n<strong>    Schema::create('songs', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('name');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u3067\u306f\u3001<code>Book<\/code>\u3082\u540c\u69d8\u306b\u4f5c\u696d\u3092\u3057\u3066\u304b\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306f\u305d\u308c\u305e\u308c\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-8625\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_2.png\" alt=\"\" width=\"350\" height=\"232\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_2.png 350w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_2-300x199.png 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8626\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_3.png\" alt=\"\" width=\"355\" height=\"232\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_3.png 355w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_3-300x196.png 300w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/p>\n<h1>\u30c6\u30b9\u30c8\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<br \/>\n\u5b9f\u884c\u624b\u9806\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u30ed\u30b0\u30a4\u30f3<\/li>\n<li>\u30c7\u30fc\u30bf\u8ffd\u52a0<\/li>\n<li>\u30c7\u30fc\u30bf\u5909\u66f4<\/li>\n<li>\u30c7\u30fc\u30bf\u95b2\u89a7<\/li>\n<li>\u30c7\u30fc\u30bf\u524a\u9664<\/li>\n<\/ol>\n<p>\u30eb\u30fc\u30c8\u306b\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::get('model_history', function(){<\/strong>\r\n\r\n    <strong>\/\/ \u30ed\u30b0\u30a4\u30f3<\/strong>\r\n<strong>    auth()-&gt;loginUsingId(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u8ffd\u52a0<\/strong>\r\n<strong>    $song = new \\App\\Models\\Song();<\/strong>\r\n<strong>    $song-&gt;name = '\u30c6\u30b9\u30c8\u66f2\u540d\uff11';<\/strong>\r\n<strong>    $song-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u5909\u66f4<\/strong>\r\n<strong>    $song-&gt;name = '\u30c6\u30b9\u30c8\u66f2\u540d\uff12';<\/strong>\r\n<strong>    $song-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u95b2\u89a7<\/strong>\r\n<strong>    $song = \\App\\Models\\Song::first();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n    \r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u524a\u9664<\/strong>\r\n<strong>    $song-&gt;delete();<\/strong>\r\n\r\n<strong>});<\/strong><\/pre>\n<p>\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u300cID\u304c<code>1<\/code>\u306e\u30e6\u30fc\u30b6\u30fc\u3067\u3001<code>songs<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u5404\uff14\u3064\u306e\u64cd\u4f5c\u3092\u884c\u3046\u300d\u3067\u3059\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001\u5c65\u6b74\u30c7\u30fc\u30bf\u306e\u6642\u9593\u304c\u540c\u3058\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u5404\u64cd\u4f5c\u306e\u9593\u306b<code>sleep()<\/code>\u3092\u306f\u3055\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u300c<strong>http:\/\/******\/model_history<\/strong>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3057\u3066\u307f\u307e\u3057\u3087\u3046\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-8627\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_4.png\" alt=\"\" width=\"677\" height=\"345\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_4.png 677w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_4-300x153.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u3046\u307e\u304f\u30c6\u30fc\u30d6\u30eb<code>model_histories<\/code>\u306b\u5404\u30c7\u30fc\u30bf\u304c\u767b\u9332\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u7d9a\u3044\u3066\u3001\u30eb\u30fc\u30c8\u306e\u4e2d\u8eab\u3092\u300cID\u304c<code>2<\/code>\u306e\u30e6\u30fc\u30b6\u30fc\u3067\u3001\u4eca\u5ea6\u306f<code>books<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066\u5404\uff14\u3064\u306e\u64cd\u4f5c\u3059\u308b\u300d\u306b\u5909\u66f4\u3057\u3066\u518d\u5ea6\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre>Route::get('model_history', function(){\r\n\r\n    <strong>\/\/ \u30ed\u30b0\u30a4\u30f3<\/strong>\r\n<strong>    auth()-&gt;loginUsingId(2);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u8ffd\u52a0<\/strong>\r\n<strong>    $book = new \\App\\Models\\Book();<\/strong>\r\n<strong>    $book-&gt;name = '\u30c6\u30b9\u30c8\u672c\u306e\u540d\u524d\uff11';<\/strong>\r\n<strong>    $book-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u5909\u66f4<\/strong>\r\n<strong>    $book-&gt;name = '\u30c6\u30b9\u30c8\u672c\u306e\u540d\u524d\uff12';<\/strong>\r\n<strong>    $book-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u95b2\u89a7<\/strong>\r\n<strong>    $book = \\App\\Models\\Book::first();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u524a\u9664<\/strong>\r\n<strong>    $book-&gt;delete();<\/strong>\r\n\r\n});<\/pre>\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-8629\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_5.png\" alt=\"\" width=\"674\" height=\"486\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_5.png 674w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_5-300x216.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/p>\n<p>\u5225\u306e\u30e2\u30c7\u30eb\u3067\u3082\u5c65\u6b74\u3092\u767b\u9332\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p>\u3067\u306f\u3001\u305b\u3063\u304b\u304f\u3067\u3059\u306e\u3067\u30e2\u30c7\u30eb\u306b\u8ffd\u52a0\u3057\u305f\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u3082\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001\u30c7\u30fc\u30bf\u304c\u7269\u7406\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u3068\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u3069\u3053\u308d\u304b\u30c7\u30fc\u30bf\u53d6\u5f97\u304c\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306b<code>softDeletes()<\/code>\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_songs_table.php<\/strong><\/p>\n<pre>Schema::create('songs', function (Blueprint $table) {\r\n    $table-&gt;id();\r\n    $table-&gt;string('name');\r\n    <strong>$table-&gt;softDeletes();  \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n    $table-&gt;timestamps();\r\n});<\/pre>\n<p>\u6b21\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30c6\u30fc\u30d6\u30eb\u3092\u518d\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8630\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_7.png\" alt=\"\" width=\"345\" height=\"251\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_7.png 345w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_7-300x218.png 300w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/p>\n<p>\u7d9a\u3044\u3066\u3001<code>Song<\/code>\u30e2\u30c7\u30eb\u304c\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u306b\u5bfe\u5fdc\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse App\\Traits\\ModelHistoryTrait;\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n<strong>use Illuminate\\Database\\Eloquent\\SoftDeletes; \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\nclass Song extends Model\r\n{\r\n    use HasFactory, ModelHistoryTrait, <strong>SoftDeletes; \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\n    \/\/ \u7701\u7565\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre>Route::get('model_history', function(){\r\n\r\n    <strong>\/\/ \u30ed\u30b0\u30a4\u30f3<\/strong>\r\n<strong>    auth()-&gt;loginUsingId(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u8ffd\u52a0<\/strong>\r\n<strong>    $song = new \\App\\Models\\Song();<\/strong>\r\n<strong>    $song-&gt;name = '\u30c6\u30b9\u30c8\u66f2\u540d\uff11';<\/strong>\r\n<strong>    $song-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u5909\u66f4<\/strong>\r\n<strong>    $song-&gt;name = '\u30c6\u30b9\u30c8\u66f2\u540d\uff12';<\/strong>\r\n<strong>    $song-&gt;save();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u524a\u9664\uff08\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\uff09<\/strong>\r\n<strong>    $song-&gt;delete();<\/strong>\r\n\r\n<strong>    sleep(1);<\/strong>\r\n\r\n<strong>    \/\/ \u30c7\u30fc\u30bf\u95b2\u89a7<\/strong>\r\n<strong>    $song = \\App\\Models\\Song::withTrashed()-&gt;with('model_histories')-&gt;first();<\/strong>\r\n<strong>    dd($song-&gt;toArray());<\/strong>\r\n\r\n});<\/pre>\n<p>\u306a\u304a\u3001\u3053\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u304c<code>withTrashed()<\/code>\u3067\u3059\u3002<br \/>\n\u3053\u308c\u3092\u3064\u3051\u3066\u3044\u308b\u3068\u3001\u3059\u3067\u306b\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3082\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3055\u3089\u306b<code>with('model_histories')<\/code>\u3067\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u3067\u5c65\u6b74\u30c7\u30fc\u30bf\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u5b9f\u884c\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-8631\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_8.png\" alt=\"\" width=\"321\" height=\"363\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_8.png 321w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/02\/laravel_model_history_8-265x300.png 265w\" sizes=\"auto, (max-width: 321px) 100vw, 321px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u95a2\u9023\u3059\u308b\u5c65\u6b74\u30c7\u30fc\u30bf\u304c<code>model_histories<\/code>\u3068\u3057\u3066\u53d6\u5f97\u3067\u304d\u3066\u3044\u307e\u3059\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\ud83d\udc4d\u2728<\/p>\n<h1>\u3061\u306a\u307f\u306b<\/h1>\n<p>\u5148\u307b\u3069\u3064\u304f\u3063\u305f<code>ModelHistoryTrait<\/code>\u306e<code>saveModelHistory()<\/code>\u306f\u3001\u5f15\u6570\u3067\u300c<strong>\u3069\u306e\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u304b<\/strong>\u300d\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<code>deleted<\/code>\u3060\u3051\u5c65\u6b74\u3092\u6b8b\u3057\u305f\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>app\/Models\/Song.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass Song extends Model\r\n{\r\n    use HasFactory, ModelHistoryTrait, SoftDeletes;\r\n\r\n    public static function boot()\r\n    {\r\n        parent::boot();\r\n\r\n        <strong>self::saveModelHistory(['deleted']); \/\/ \ud83d\udc48 \u3053\u3053\u3067\u3059<\/strong>\r\n    }\r\n}<\/pre>\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\u3059\u308b\u3053\u3068\u304c\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=8632&amp;tmstv=1777537657\" rel=\"nofollow\" id=\"download-link-8632\" data-redirect=\"false\" >\n\t\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u3057\u305f\u4eba\u306e\u5c65\u6b74\u3092\u81ea\u52d5\u3067\u4fdd\u5b58\u3059\u308b<\/a>\n\n<p>\u203b \u305f\u3060\u3057\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u7b49\u306f\u3054\u81ea\u8eab\u3067\u884c\u3063\u3066\u3044\u305f\u3060\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u30c7\u30fc\u30bf\u306e\u64cd\u4f5c\u5c65\u6b74\u3092\u6b8b\u3059\u305f\u3081\u306e\u6a5f\u80fd\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><code>Laravel<\/code>\u306b\u306f\u30a4\u30d9\u30f3\u30c8\u306a\u3069\u300c\u30e9\u30af\u300d\u3067\u304d\u308b\u6a5f\u80fd\u304c\u305f\u304f\u3055\u3093\u3064\u3044\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4e88\u60f3\u4ee5\u4e0a\u306b\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30fc\u30c9\u3067\u5b8c\u6210\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\ud83d\udc4d<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u6a5f\u80fd\u3092\u62e1\u5f35\u3059\u308b\u30a2\u30a4\u30c7\u30a2\u3068\u3057\u3066\u306f\u3001\u3069\u306e\u30c7\u30fc\u30bf\u304b\u3089\u3069\u306e\u30c7\u30fc\u30bf\u306b\u5909\u66f4\u3055\u308c\u305f\u304b\u3068\u3044\u3046<code>old_value<\/code>, <code>new_value<\/code> \u307f\u305f\u3044\u306a\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u3064\u304f\u3063\u3066\u304a\u3051\u3070\u3001\u3042\u3068\u3067\u3088\u308a\u8a73\u3057\u3044\u5c65\u6b74\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u307f\u306a\u3055\u3093\u3082\u3001\u3044\u308d\u3044\u308d\u3068\u30a2\u30a4\u30c7\u30a2\u3092\u8003\u3048\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-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u3042\u3041\u301c\u3001\u30b8\u30a7\u30d5\u30fb\u30d9\u30be\u30b9\u304c\u304a\u5144\u3061\u3083\u3093\u3060\u3063\u305f\u3089\u306a\u301c<br \/>\n\u30b4\u30ed\u30b4\u30ed\u301c\uff08\u7b11\uff09 by \u305a\u3093 \u98ef\u5c3e\u3055\u3093\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u5e78\u904b\u306b\u3082\u9577\u3089\u304f\u958b\u767a\u306e\u304a\u4ed5\u4e8b\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u4e2d\u306b\u306f\u3001\u300c\u305d\u308c\u307b\u3069\u9700\u8981\u304c\u591a\u3044\u308f\u3051\u3067\u306f\u306a\u3044\u3051\u3069\u3001\u305f\u307e\u306b\u6b32\u3057\u3044\u300d\u3068\u8a00\u308f\u308c\u308b\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=8622\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel\u3011\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u3057\u305f\u4eba\u306e\u5c65\u6b74\u3092\u81ea\u52d5\u3067\u4fdd\u5b58\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":8638,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,97],"tags":[],"class_list":["post-8622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-97"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8622","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=8622"}],"version-history":[{"count":4,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8622\/revisions"}],"predecessor-version":[{"id":8637,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8622\/revisions\/8637"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/8638"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}