{"id":54831,"date":"2024-02-09T03:35:14","date_gmt":"2024-02-08T18:35:14","guid":{"rendered":"https:\/\/kinsta.com\/jp\/?p=54831&#038;preview=true&#038;preview_id=54831"},"modified":"2024-04-23T03:58:21","modified_gmt":"2024-04-22T18:58:21","slug":"laravel-eloquent","status":"publish","type":"post","link":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/","title":{"rendered":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd"},"content":{"rendered":"<p><a href=\"https:\/\/kinsta.com\/jp\/topics\/laravel\/\">Laravel<\/a>\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u4f7f\u3044\u3084\u3059\u3044<a href=\"https:\/\/kinsta.com\/jp\/blog\/php-frameworks\/\">PHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/a>\u3068\u3057\u3066\u4eba\u6c17\u3092\u535a\u3057\u307e\u3059\u3002\u305d\u306e\u4fbf\u5229\u306a\u6a5f\u80fd\u306e1\u3064\u304cEloquent\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30ec\u30b3\u30fc\u30c9\u51e6\u7406\u3092\u7c21\u7d20\u5316\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u95a2\u4fc2\u30de\u30c3\u30d4\u30f3\u30b0\uff08ORM\uff09\u3067\u3059\u3002<\/p>\n<p>Eloquent\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5bfe\u3059\u308b\u4f5c\u6210\u3001\u8aad\u307f\u53d6\u308a\u3001\u66f4\u65b0\u3001\u304a\u3088\u3073\u524a\u9664\u64cd\u4f5c\u3092\u9ad8\u901f\u5316\u3057\u307e\u3059\u3002Eloquent\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u30df\u30e9\u30fc\u3059\u308b\u30e2\u30c7\u30eb\u3092\u7528\u610f\u3057\u3001\u305d\u308c\u3092\u4f7f\u7528\u3057\u3066\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Eloquent\u306e\u6700\u3082\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3042\u308b\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u306e6\u3064\u306b\u3064\u3044\u3066\u3054\u8aac\u660e\u3057\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u306e\u6a5f\u80fd\u304c\u3069\u306e\u3088\u3046\u306a\u50cd\u304d\u3092\u3059\u308b\u306e\u304b\u3001\u5b9f\u8df5\u7684\u306a\u4f8b\u3092\u7528\u3044\u307e\u3059\u3002\u4f8b\u3092\u53c2\u8003\u306b\u3001<a href=\"https:\/\/laravel.com\/docs\/10.x\/eloquent\" target=\"_blank\" rel=\"noopener noreferrer\">Laravel Eloquent<\/a>\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u7406\u89e3\u3092\u6df1\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div><\/div><kinsta-auto-toc heading=\"Table of Contents\" exclude=\"last\" list-style=\"arrow\" selector=\"h2\" count-number=\"-1\"><\/kinsta-auto-toc>\n<h2>1. Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7<\/h2>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u3066\u3044\u308b\u3068\u3001\u6761\u4ef6\u3092\u8907\u6570\u56de\u4f7f\u7528\u3059\u308b\u5834\u9762\u306b\u906d\u9047\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u90fd\u5ea6\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u76f4\u3059\u3068\u3001\u30a8\u30e9\u30fc\u306e\u53ef\u80fd\u6027\u304c\u9ad8\u304f\u306a\u308a\u3001\u30b3\u30fc\u30c9\u304c\u6574\u9813\u3055\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002Laravel\u3067\u306f\u3001\u3053\u306e\u3088\u3046\u306a\u6761\u4ef6\u3092\u30b9\u30b3\u30fc\u30d7\u3068\u547c\u3070\u308c\u308b\u518d\u5229\u7528\u53ef\u80fd\u306a\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u30e9\u30c3\u30d7\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u306f\u3001\u30e2\u30c7\u30eb\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ed\u30b8\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u3001\u30af\u30a8\u30ea\u30ed\u30b8\u30c3\u30af\u3092\u518d\u5229\u7528\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306b\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\u5b8c\u6210\u3057\u305f\u6a5f\u80fd\u3068\u9032\u884c\u4e2d\u306e\u6a5f\u80fd\u3092\u8ffd\u8de1\u3059\u308b\u3001\u30c1\u30fc\u30e0\u3067\u4f7f\u7528\u3067\u304d\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u305f\u3044\u3068\u3057\u307e\u3059\u3002\u3053\u306e\u6761\u4ef6\u3092\u4f7f\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u9032\u884c\u4e2d\u306e\u6a5f\u80fd\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$onGoing = Project::where('ongoing', 1)-&gt;get();<\/code><\/pre>\n<p>\u3053\u306e\u6761\u4ef6\u306f\u3001\u7d71\u8a08\u30da\u30fc\u30b8\u306a\u3069\u3001\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30da\u30fc\u30b8\u3067\u3082\u5fc5\u8981\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4e0a\u8a18\u306e\u6761\u4ef6\u3092\u518d\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30af\u30a8\u30ea\u3092\u5358\u7d14\u5316\u3057\u3066\u30b3\u30fc\u30c9\u3092\u3059\u3063\u304d\u308a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u306e\u4f7f\u3044\u65b9\u306f\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">class Features extends Model\n{\n    public function scopeOngoing($query)\n    {\n        return $query-&gt;where('ongoing', 0);\n    }\n}<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u305d\u306e\u30b9\u30b3\u30fc\u30d7\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$onGoing = Feature::ongoing()-&gt;get();<\/code><\/pre>\n<p>\u30b9\u30b3\u30fc\u30d7\u306b\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u3068\u30ed\u30fc\u30ab\u30eb\u306e2\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7<\/h3>\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u306f\u3001\u30e2\u30c7\u30eb\u5185\u306e\u3059\u3079\u3066\u306e\u30af\u30a8\u30ea\u306b\u5236\u7d04\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30e2\u30c7\u30eb\u5185\u306e\u3059\u3079\u3066\u306e\u30af\u30a8\u30ea\u306b\u3001\u30c1\u30fc\u30e0\u30ea\u30fc\u30c0\u30fc\u306e\u540d\u524d\u306b\u57fa\u3065\u3044\u3066\u6a5f\u80fd\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3059\u308b\u6761\u4ef6\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7<\/h3>\n<p>\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u306f\u3001\u518d\u5229\u7528\u6027\u3092\u8003\u3048\u3066\u5171\u901a\u306e\u5236\u7d04\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d0\u30b0\u304c\u3042\u308b\u6a5f\u80fd\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u8fd4\u3055\u305b\u305f\u3044\u3068\u3057\u307e\u3059\u3002\u30b3\u30fc\u30c9\u3067\u306f\u3001\u4f8b\u3048\u3070\u6b21\u306e\u3088\u3046\u306a\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">namespace AppModels;\nuse IlluminateDatabaseEloquentModel;\n\nclass User extends Model\n{\n    public function scopeBugged($query)\n    {\n        return $query-&gt;where('bugged', '&gt;', 1);\n    }\n}<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u306f\u3001\u672a\u89e3\u6c7a\u306e\u30d0\u30b0\u306e\u3042\u308b\u3059\u3079\u3066\u306e\u6a5f\u80fd\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<h2>2. Eloquent\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3<\/h2>\n<p>Eloquent\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7c21\u5358\u306b\u95a2\u9023\u4ed8\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001EC\u30b5\u30a4\u30c8\u306e\u5546\u54c1\u306b\u306f\u5728\u5eab\u3001\u4fa1\u683c\u3001\u95b2\u89a7\u6570\u3001\u30ec\u30d3\u30e5\u30fc\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002Eloquent\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30ec\u30b3\u30fc\u30c9\u304c\u7570\u306a\u308b\u30c6\u30fc\u30d6\u30eb\u306b\u3042\u308b\u5834\u5408\u3067\u3082\u3001\u305d\u308c\u305e\u308c\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Eloquent\u30e2\u30c7\u30eb\u3068\u540c\u3058\u3088\u3046\u306b\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002Eloquent\u3067\u3088\u304f\u4f7f\u308f\u308c\u308b\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u306f\u30011\u5bfe1\u30011\u5bfe\u591a\u3001\u591a\u76f8\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>1\u5bfe1<\/h3>\n<p>\u5546\u54c1\u30e2\u30c7\u30eb\u3068\u5728\u5eab\u3092\u95a2\u9023\u4ed8\u3051\u308b\u57fa\u672c\u7684\u306a1\u5bfe1\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\u3092\u4ee5\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">public function Inventory()\n{\n    return $this-&gt;hasOne('AppInventory');\n}<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>Inventory()<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u5546\u54c1\u30e2\u30c7\u30eb\u306e<code>hasOne()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u5546\u54c1\u304c\u8cfc\u5165\u53ef\u80fd\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<h3>1\u5bfe\u591a<\/h3>\n<p>Eloquent\u3067\u306f\u30011\u5bfe\u591a\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u95b2\u89a7\u6570\u306b\u57fa\u3065\u3044\u3066\u5546\u54c1\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u3067\u3059\u30021\u5bfe\u591a\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u8a2a\u554f\u8005\u304c\u6700\u3082\u8208\u5473\u3092\u5bc4\u305b\u3066\u3044\u308b\u5546\u54c1\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<code>hasOne()<\/code>\u306e1\u5bfe\u591a\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u3042\u308b<code>belongsTo()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">public function product()\n{\n    return $this-&gt;belongsTo('AppProduct');\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001Eloquent\u306b\u3088\u308a<code>product_id<\/code>\u304c\u6e21\u3055\u308c\u305f\u30d3\u30e5\u30fc\u6570\u306b\u7d10\u3065\u3051\u3089\u308c\u307e\u3059\u3002<code>product_id<\/code>\u306f\u3001\u305d\u306e\u5f8c\u3001\u4fa1\u683c\u3084\u5728\u5eab\u306a\u3069\u306e\u4ed6\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u306e\u306b\u6709\u7528\u3067\u3059\u3002<\/p>\n<h3>\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30c3\u30af<\/h3>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306f\u5fc5\u305a\u3057\u3082\u5358\u7d14\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u8907\u6570\u306e\u30e2\u30c7\u30eb\u30bf\u30a4\u30d7\u306b\u5c5e\u3059\u308b\u30e2\u30c7\u30eb\u3082\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\u3001\u5546\u54c1\u30e2\u30c7\u30eb\u3068\u5728\u5eab\u30e2\u30c7\u30eb\u306f\u3069\u3061\u3089\u3082\u753b\u50cf\u30e2\u30c7\u30eb\u306b\u5bfe\u3057\u3066\u591a\u76f8\u7684\u306a\u95a2\u4fc2\u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/kinsta.com\/jp\/blog\/laravel-relationships\/#polymorphic-relationships\">\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30c3\u30af<\/a>\u306a\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u3063\u3066\u3001\u5728\u5eab\u3068\u5546\u54c1\u306e\u4e21\u65b9\u306b\u540c\u3058\u753b\u50cf\u30ea\u30b9\u30c8\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30c3\u30af\uff08\u591a\u76f8\uff09\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u88c5\u3057\u305f\u30b3\u30fc\u30c9\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">class Image extends Model\n{\n    \/**\n     * Getting the shared image.\n     *\/\n    public function myimage()\n    {\n        return $this-&gt;morphTo();\n    }\n}\n\nclass Product extends Model\n{\n    \/**\n     * Get the image to use on the product's page.\n     *\/\n    public function image()\n    {\n        return $this-&gt;morphOne(Image::class, 'myimage');\n    }\n}\n\nclass Inventory extends Model\n{\n    \/**\n     * Get the image to use on the inventory page.\n     *\/\n    public function image()\n    {\n        return $this-&gt;morphOne(Image::class, 'myimage');\n    }\n}<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>morphTo()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30c3\u30af\u30e2\u30c7\u30eb\u306e\u89aa\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u3042\u304f\u307e\u3067\u3082\u3053\u306e\u30c8\u30d4\u30c3\u30af\u306b\u95a2\u3059\u308b\u6c37\u5c71\u306e\u4e00\u89d2\u306b\u904e\u304e\u307e\u305b\u3093\u3002\u8a73\u3057\u304f\u306f\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/laravel-relationships\/\">Laravel Eloquent\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u306e\u8a73\u3057\u3044\u89e3\u8aac<\/a>\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>3. Eloquent\u306e\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5<\/h2>\n<p>\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u305f\u308a\u53d6\u5f97\u3057\u305f\u308a\u3059\u308b\u969b\u306b\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002\u30df\u30e5\u30fc\u30c6\u30bf\u306f\u4fdd\u5b58\u524d\u306b\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3057\u3001\u30a2\u30af\u30bb\u30b5\u306f\u53d6\u5f97\u306b\u969b\u3057\u3066\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u540d\u524d\u3092\u5c0f\u6587\u5b57\u3067\u4fdd\u5b58\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u3001\u305d\u306e\u5909\u63db\u3092\u5b9f\u884c\u3059\u308b\u30df\u30e5\u30fc\u30c6\u30bf\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u306e\u30da\u30fc\u30b8\u3067\u30e6\u30fc\u30b6\u30fc\u306e\u59d3\u3068\u540d\u30921\u3064\u306e\u540d\u524d\u3068\u3057\u3066\u8868\u793a\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u3001\u305d\u306e\u305f\u3081\u306e\u30a2\u30af\u30bb\u30b5\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u540d\u524d\u3092\u4fdd\u5b58\u3059\u308b\u524d\u306b\u5927\u6587\u5b57\u306b\u3059\u308b\u30df\u30e5\u30fc\u30c6\u30bf\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">class User extends Model\n{\n    \/**\n     * \u59d3\u3068\u540d\u3092\u5927\u6587\u5b57\u306b\u3059\u308b\u30df\u30e5\u30fc\u30c6\u30bf\n     *\/\n    public function setFirstNameAttribute($value)\n    {\n        $this-&gt;attributes['first_name'] = ucfirst($value);\n    }\n\n    public function setLastNameAttribute($value)\n    {\n        $this-&gt;attributes['last_name'] = ucfirst($value);\n    }\n}<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u59d3\u3068\u540d\u3092\u7d50\u5408\u3059\u308b\u30a2\u30af\u30bb\u30b5\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">class User extends Model\n{\n    \/**\n     * \u59d3\u3068\u540d\u3092\u7d50\u5408\u3059\u308b\u30a2\u30af\u30bb\u30b5\n     *\/\n    public function getFullNameAttribute()\n    {\n        return ucfirst($this-&gt;first_name) . ' ' . ucfirst($this-&gt;last_name);\n    }\n}<\/code><\/pre>\n<h2>4. Eloquent\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h2>\n<p>Eloquent\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u3001\u8907\u6570\u306e\u30e2\u30c7\u30eb\u306e\u7d50\u679c\u3092\u8fd4\u3059\u30e1\u30bd\u30c3\u30c9\u3092\u6271\u3044\u307e\u3059\u3002\u3053\u306e\u30af\u30e9\u30b9\u306f<code>IlluminateDatabaseEloquentCollection<\/code>\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u914d\u5217\u3068\u540c\u69d8\u306b\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u5358\u7d14\u306a\u53cd\u5fa9\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">use AppModelsProduct;\n\n$products = Product::where('availability', 1)-&gt;get();\n\nforeach ($products as $product) {\n   echo $product-&gt;name;\n}<\/code><\/pre>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u914d\u5217\u3088\u308a\u3082\u5f37\u529b\u3067\u3001\u3088\u308a\u8907\u96d1\u306a\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u5229\u7528\u53ef\u80fd\u306a\u3059\u3079\u3066\u306e\u5546\u54c1\u306e\u4e00\u89a7\u3092\u8868\u793a\u3057\u3001\u300cactive\u300d\u3067\u306a\u3044\u3082\u306e\u306f\u3059\u3079\u3066\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$names = Product::all()-&gt;reject(function ($product) {\n   return $product-&gt;active === false;\n})-&gt;map(function ($product) {\n   return $product-&gt;name;\n});<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306b\u3042\u308b\u8907\u6570\u30e1\u30bd\u30c3\u30c9\u306e\u4e00\u90e8\u3067\u3059\u3002<\/p>\n<h3>contains<\/h3>\n<p><code>contains()<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b\u3001\u6307\u5b9a\u3057\u305f\u30e2\u30fc\u30c9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$products-&gt;contains(1);\n$products-&gt;contains(Product::find(1));<\/code><\/pre>\n<h3>All<\/h3>\n<p><code>all()<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u542b\u307e\u308c\u308b\u30e2\u30c7\u30eb\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$collection = Product::all();<\/code><\/pre>\n<p><a href=\"https:\/\/laravel.com\/docs\/9.x\/eloquent-collections\" target=\"blank\" rel=\"noopener\">\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9<\/a>\u3067\u306f\u3001\u4ed6\u306b\u3082\u591a\u304f\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>5. Eloquent\u306e\u30e2\u30c7\u30eb\u306e\u524a\u9664<\/h2>\n<p>Eloquent\u3067\u306f\u3001\u30af\u30a8\u30ea\u306e\u69cb\u7bc9\u306b\u5f79\u7acb\u3064\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u6642\u306b\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u52b9\u7387\u7684\u306b\u3059\u308b\u305f\u3081\u306b\u30e2\u30c7\u30eb\u306e\u524a\u9664\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001\u30e2\u30c7\u30eb\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067<code>delete<\/code>\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">use AppModelsStock;\n\n$stock = Stock::find(1);\n$stock-&gt;delete();<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306b\u3088\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u30e2\u30c7\u30eb<code>Stock<\/code>\u304c\u524a\u9664\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306f\u6c38\u4e45\u7684\u306a\u524a\u9664\u3067\u3001\u5143\u306b\u623b\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\uff08\u8ad6\u7406\u524a\u9664\uff09<\/h3>\n<p>Eloquent\u306e\u3082\u3046\u4e00\u3064\u306e\u6a5f\u80fd\u306f\u30e2\u30c7\u30eb\u306e\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3067\u3059\u3002\u30e2\u30c7\u30eb\u3092\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\uff08\u8ad6\u7406\u524a\u9664\uff09\u3057\u3066\u3082\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u524a\u9664\u3055\u308c\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><code>deleted_at<\/code>\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u306e\u65e5\u6642\u3092\u793a\u3059\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u4e00\u90e8\u3092\u6c38\u4e45\u306b\u524a\u9664\u3059\u308b\u3053\u3068\u306a\u304f\u3001\u4e0d\u5b8c\u5168\u306a\u3082\u306e\u306a\u3069\u3092\u9664\u5916\u3057\u305f\u3044\u5834\u5408\u306b\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3059\u3002\u4f59\u5206\u306a\u6761\u4ef6\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306a\u304f\u3001Eloquent\u306e\u30af\u30a8\u30ea\u7d50\u679c\u3092\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306f\u3001<code>softDeletes<\/code>\u3092\u30e2\u30c7\u30eb\u306b\u8ffd\u52a0\u3057\u3001\u95a2\u9023\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b<code>deleted_at<\/code>\u306e\u5217\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30e2\u30c7\u30eb\u306b\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001<code>IlluminateDatabaseEloquentSoftDeletes<\/code>\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u30e2\u30c7\u30eb\u306e\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">namespace AppModels;\nuse IlluminateDatabaseEloquentModel;\nuse IlluminateDatabaseEloquentSoftDeletes;\n\nclass Flight extends Model\n{\n   use SoftDeletes;\n}<\/code><\/pre>\n<h3>delete_at \u30ab\u30e9\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5<\/h3>\n<p>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3092\u4f7f\u3044\u59cb\u3081\u308b\u524d\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b<code>delete_at<\/code>\u30ab\u30e9\u30e0\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30ab\u30e9\u30e0\u306fLaravel\u306e<code>Schemab<\/code>\u30d3\u30eb\u30c0\u30d8\u30eb\u30d1\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">use IlluminateDatabaseSchemaBlueprint;\nuse IlluminateSupportFacadesSchema;\n\nSchema::table('users', function (Blueprint $table) {\n   $table-&gt;softDeletes();\n});\n\nSchema::table('users', function (Blueprint $table) {\n   $table-&gt;dropSoftDeletes();\n});<\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u304c\u6210\u529f\u3057\u305f\u5834\u5408\u306b\u65e5\u4ed8\u3068\u6642\u523b\u306e\u60c5\u5831\u304c\u66f4\u65b0\u3055\u308c\u308b<code>delete_at<\/code>\u30ab\u30e9\u30e0\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u3092\u5bfe\u8c61\u3068\u3059\u308b\u65b9\u6cd5<\/h3>\n<p>\u30af\u30a8\u30ea\u306e\u7d50\u679c\u306b\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u3092\u542b\u3081\u308b\u306b\u306f\u3001<code>withTrashed()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u30af\u30a8\u30ea\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$stocks = Stock::withTrashed()-&gt;where('stock_id', 20)-&gt;get();<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30af\u30a8\u30ea\u306b\u306f\u3001<code>deleted_at<\/code>\u5c5e\u6027\u3092\u6301\u3064\u30e2\u30c7\u30eb\u3082\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5<\/h3>\n<p>Eloquent\u3067\u306f\u3001\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001\u4f8b\u3048\u3070<code>onlyTrashed()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$Stock = Stock::onlyTrashed()-&gt;where('stock_id', 1)-&gt;get();<\/code><\/pre>\n<h3>\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u3092\u5fa9\u5143\u3059\u308b\u65b9\u6cd5<\/h3>\n<p><code>restore()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u3067\u3001\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u3092\u5fa9\u5143\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$stocks = Stock::withTrashed()-&gt;where('stock_id', 20)-&gt;restore();<\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3057\u305f\u30e2\u30c7\u30eb\u306e<code>delete_at<\/code>\u30d5\u30a3\u30fc\u30eb\u30c9\u304cnull\u306b\u5909\u308f\u308a\u307e\u3059\u3002\u30e2\u30c7\u30eb\u304c\u30bd\u30d5\u30c8\u30c7\u30ea\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u306f\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>6. Eloquent\u306e\u30d5\u30a1\u30af\u30c8\u30ea<\/h2>\n<p>Laravel\u306e\u30e2\u30c7\u30eb\u30d5\u30a1\u30af\u30c8\u30ea\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c6\u30b9\u30c8\u3084\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b7\u30fc\u30c9\u306b\u4f7f\u7528\u3059\u308b\u30c0\u30df\u30fc\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3059\u308b\u306e\u306b\u6709\u7528\u3067\u3059\u3002\u3053\u308c\u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u4f8b\u306b\u793a\u3059\u3088\u3046\u306b\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u30af\u30e9\u30b9\u3067\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30b3\u30fc\u30c9\u306b\u3088\u308a\u3001\u30c0\u30df\u30fc\u306e\u30b5\u30d7\u30e9\u30a4\u30e4\u30fc\u540d\u3068\u4fa1\u683c\u3092\u751f\u6210\u3059\u308b\u30e2\u30c7\u30eb\u30d5\u30a1\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">namespace DatabaseFactories;\nuse IlluminateDatabaseEloquentFactoriesFactory;\nuse IlluminateSupportStr;\n\nclass StockFactory extends Factory\n{\n    public function definition()\n    {\n        return [\n            'supplier_name' =&gt; fake()-&gt;name(),\n            'price' =&gt; fake()-&gt;numberBetween($min = 1500, $max = 6000),\n        ];\n    }\n}<\/code><\/pre>\n<p>\u4e0a\u306e\u4f8b\u306e<code>definition()<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30e2\u30c7\u30eb\u69cb\u7bc9\u6642\u306bLaravel\u304c\u4f7f\u7528\u3059\u308b\u5c5e\u6027\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002fake\u30d8\u30eb\u30d1\u306f\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u304cPHP\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308b<a href=\"https:\/\/fakerphp.github.io\/\" target=\"blank\" rel=\"noopener\">Faker<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306e\u3092\u52a9\u3051\u308b\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n<h2 id=\"h.kvdd4m1lmda5\">\u307e\u3068\u3081<\/h2>\n<p>Eloquent\u306f\u3001Laravel\u3067\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u4f5c\u696d\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u3059\u308b\u4ee3\u7269\u3067\u3059\u3002\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u3088\u3046\u306a\u5b9f\u88c5\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5358\u7d14\u306a\u30af\u30a8\u30ea\u3067\u3082\u8907\u96d1\u306a\u30af\u30a8\u30ea\u3067\u3082\u3001\u540c\u3058\u3088\u3046\u306b\u52b9\u679c\u7684\u306b\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002\u30d5\u30a1\u30af\u30c8\u30ea\u3092\u4f7f\u7528\u3057\u3066\u3059\u3050\u306b\u30c0\u30df\u30fc\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3067\u304d\u308b\u304a\u624b\u8efd\u3055\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c6\u30b9\u30c8\u3092\u52b9\u7387\u7684\u306b\u5b9f\u65bd\u3057\u305f\u3044\u958b\u767a\u8005\u306b\u6b20\u304b\u305b\u306a\u3044\u9078\u629e\u80a2\u3067\u3059\u3002\u3055\u3089\u306b\u3001Eloquent\u30b9\u30b3\u30fc\u30d7\u306f\u8907\u96d1\u306a\u30af\u30a8\u30ea\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u3057\u3001\u30b3\u30fc\u30c9\u3092\u6574\u9813\u3059\u308b\u306e\u306b\u52b9\u679c\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u4e3b\u8981\u306a\u6a5f\u80fd\u306e\u3046\u30616\u3064\u3060\u3051\u3092\u53d6\u308a\u4e0a\u3052\u307e\u3057\u305f\u304c\u3001Eloquent\u306b\u306f\u4ed6\u306b\u3082\u5f37\u529b\u306a\u6a5f\u80fd\u304c\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u3002\u5171\u6709\u3084\u518d\u5229\u7528\u304c\u6357\u308b\u30e2\u30c7\u30eb\u306e\u4f7f\u7528\u306b\u3088\u308a\u3001Eloquent\u306f\u958b\u767a\u8005\u306e\u9593\u3067\u4eba\u6c17\u306e\u3042\u308b\u6a5f\u80fd\u3067\u3042\u308a\u3001Eloquent\u30af\u30a8\u30ea\u306e\u30b7\u30f3\u30d7\u30eb\u3055\u306b\u3088\u308a\u3001Laravel\u306f\u521d\u5fc3\u8005\u3067\u3082\u958b\u767a\u3057\u3084\u3059\u3044\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Kinsta\u306e<a href=\"https:\/\/sevalla.com\/application-hosting\/\">\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0<\/a>\u306f\u5229\u7528\u8005\u306e\u6280\u8853\u30ec\u30d9\u30eb\u306b\u95a2\u4fc2\u306a\u304f\u3001\u958b\u767a\u4f5c\u696d\u306e\u52b9\u7387\u5316\u3092\u652f\u63f4\u3057\u307e\u3059\u3002Kinsta\u306e<a href=\"https:\/\/docs.sevalla.com\/templates\/overviewphp-examples#laravel\">Laravel\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff08\u3059\u3050\u306b\u4f7f\u3048\u308b\u6d3b\u7528\u4f8b\uff09 <\/a>\u3082\u3042\u308f\u305b\u3066\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002Google Cloud\u306e<a href=\"https:\/\/kinsta.com\/jp\/blog\/cloud-platform-for-developers\/\">\u30d7\u30ec\u30df\u30a2\u30e0\u30c6\u30a3\u30a2\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/a>\u3092\u4f7f\u3044\u306a\u304c\u3089\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7d20\u65e9\u304f\u7c21\u5358\u306b\u7acb\u3061\u4e0a\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Laravel\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u4f7f\u3044\u3084\u3059\u3044PHP\u30d5\u30ec &#8230;<\/p>\n","protected":false},"author":259,"featured_media":54832,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[],"topic":[784],"class_list":["post-54831","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","topic-laravel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\uff5cKinsta\u00ae<\/title>\n<meta name=\"description\" content=\"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\" \/>\n<meta property=\"og:description\" content=\"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-08T18:35:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-22T18:58:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"730\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Steve Bonisteel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\" \/>\n<meta name=\"twitter:creator\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Steve Bonisteel\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\"},\"author\":{\"name\":\"Steve Bonisteel\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/d84ceff87bd64a4368a581fc8aa8bd6f\"},\"headline\":\"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\",\"datePublished\":\"2024-02-08T18:35:14+00:00\",\"dateModified\":\"2024-04-22T18:58:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\"},\"wordCount\":59,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\",\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\",\"url\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\",\"name\":\"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\uff5cKinsta\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\",\"datePublished\":\"2024-02-08T18:35:14+00:00\",\"dateModified\":\"2024-04-22T18:58:21+00:00\",\"description\":\"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png\",\"width\":1460,\"height\":730},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/jp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Laravel\",\"item\":\"https:\/\/kinsta.com\/jp\/topics\/laravel\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/jp\/#website\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/jp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\",\"https:\/\/x.com\/Kinsta_JP\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/d84ceff87bd64a4368a581fc8aa8bd6f\",\"name\":\"Steve Bonisteel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0adffb3f9c86a6ec8245f8399d540823?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0adffb3f9c86a6ec8245f8399d540823?s=96&d=mm&r=g\",\"caption\":\"Steve Bonisteel\"},\"description\":\"Steve Bonisteel is a Technical Editor at Kinsta who began his writing career as a print journalist, chasing ambulances and fire trucks. He has been covering Internet-related technology since the late 1990s.\",\"url\":\"https:\/\/kinsta.com\/jp\/blog\/author\/stevebonisteel\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\uff5cKinsta\u00ae","description":"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/","og_locale":"ja_JP","og_type":"article","og_title":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd","og_description":"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002","og_url":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","article_published_time":"2024-02-08T18:35:14+00:00","article_modified_time":"2024-04-22T18:58:21+00:00","og_image":[{"width":1460,"height":730,"url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","type":"image\/png"}],"author":"Steve Bonisteel","twitter_card":"summary_large_image","twitter_description":"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002","twitter_image":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","twitter_creator":"@Kinsta_JP","twitter_site":"@Kinsta_JP","twitter_misc":{"\u57f7\u7b46\u8005":"Steve Bonisteel","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/"},"author":{"name":"Steve Bonisteel","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/d84ceff87bd64a4368a581fc8aa8bd6f"},"headline":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd","datePublished":"2024-02-08T18:35:14+00:00","dateModified":"2024-04-22T18:58:21+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/"},"wordCount":59,"commentCount":0,"publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/","url":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/","name":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd\uff5cKinsta\u00ae","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","datePublished":"2024-02-08T18:35:14+00:00","dateModified":"2024-04-22T18:58:21+00:00","description":"Eloquent\u306e\u30af\u30a8\u30ea\u30b9\u30b3\u30fc\u30d7\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30df\u30e5\u30fc\u30c6\u30bf\u3068\u30a2\u30af\u30bb\u30b5\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u30e2\u30c7\u30eb\u524a\u9664\u3001\u30d5\u30a1\u30af\u30c8\u30ea\u3067Laravel\u3092\u4f7f\u3063\u305f\u958b\u767a\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u3092\u56f3\u308a\u307e\u3057\u3087\u3046\u3002","breadcrumb":{"@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#primaryimage","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/02\/master-laravel-eloquent.png","width":1460,"height":730},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/jp\/blog\/laravel-eloquent\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/jp\/"},{"@type":"ListItem","position":2,"name":"Laravel","item":"https:\/\/kinsta.com\/jp\/topics\/laravel\/"},{"@type":"ListItem","position":3,"name":"\u30106\u3064\u306e\u57fa\u790e\u3011Laravel Eloquent\u306e\u4eca\u3055\u3089\u805e\u3051\u306a\u3044\u5927\u4e8b\u306a\u6a5f\u80fd"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/jp\/#website","url":"https:\/\/kinsta.com\/jp\/","name":"Kinsta\u00ae","description":"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9","publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/jp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/jp\/#organization","name":"Kinsta","url":"https:\/\/kinsta.com\/jp\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","https:\/\/x.com\/Kinsta_JP","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/d84ceff87bd64a4368a581fc8aa8bd6f","name":"Steve Bonisteel","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0adffb3f9c86a6ec8245f8399d540823?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0adffb3f9c86a6ec8245f8399d540823?s=96&d=mm&r=g","caption":"Steve Bonisteel"},"description":"Steve Bonisteel is a Technical Editor at Kinsta who began his writing career as a print journalist, chasing ambulances and fire trucks. He has been covering Internet-related technology since the late 1990s.","url":"https:\/\/kinsta.com\/jp\/blog\/author\/stevebonisteel\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/54831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/users\/259"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/comments?post=54831"}],"version-history":[{"count":10,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/54831\/revisions"}],"predecessor-version":[{"id":56996,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/54831\/revisions\/56996"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/en"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/it"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/pt"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/fr"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/de"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/jp"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/es"},{"embeddable":true,"hreflang":"nl","title":"Dutch","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/translations\/nl"},{"href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54831\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media\/54832"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media?parent=54831"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/tags?post=54831"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/topic?post=54831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}