{"id":1161,"date":"2017-06-09T11:18:31","date_gmt":"2017-06-09T03:18:31","guid":{"rendered":"http:\/\/www.poloo.org\/?p=1161"},"modified":"2017-12-11T18:25:34","modified_gmt":"2017-12-11T10:25:34","slug":"laravel-%e4%b9%8beloquent-orm%e4%bd%bf%e7%94%a8%e9%80%9f%e6%9f%a5-%e9%ab%98%e7%ba%a7%e9%83%a8%e5%88%86","status":"publish","type":"post","link":"https:\/\/www.poloo.org\/?p=1161","title":{"rendered":"Laravel \u4e4bEloquent ORM\u4f7f\u7528\u901f\u67e5-\u9ad8\u7ea7\u90e8\u5206"},"content":{"rendered":"<h2>\u67e5\u8be2\u4f5c\u7528\u57df<\/h2>\n<h3>\u5168\u5c40\u4f5c\u7528\u57df<\/h3>\n<p>\u5168\u5c40\u4f5c\u7528\u57df\u5141\u8bb8\u4f60\u5bf9\u7ed9\u5b9a\u6a21\u578b\u7684\u6240\u6709\u67e5\u8be2\u6dfb\u52a0\u7ea6\u675f\u3002\u4f7f\u7528\u5168\u5c40\u4f5c\u7528\u57df\u529f\u80fd\u53ef\u4ee5\u4e3a\u6a21\u578b\u7684\u6240\u6709\u64cd\u4f5c\u589e\u52a0\u7ea6\u675f\u3002<\/p>\n<p>\u8f6f\u5220\u9664\u529f\u80fd\u5b9e\u9645\u4e0a\u5c31\u662f\u5229\u7528\u4e86\u5168\u5c40\u4f5c\u7528\u57df\u529f\u80fd<br \/>\n\u5b9e\u73b0\u4e00\u4e2a\u5168\u5c40\u4f5c\u7528\u57df\u529f\u80fd\u53ea\u9700\u8981\u5b9a\u4e49\u4e00\u4e2a\u5b9e\u73b0Illuminate\\Database\\Eloquent\\Scope\u63a5\u53e3\u7684\u7c7b\uff0c\u8be5\u63a5\u53e3\u53ea\u6709\u4e00\u4e2a\u65b9\u6cd5apply\uff0c\u5728\u8be5\u65b9\u6cd5\u4e2d\u589e\u52a0\u67e5\u8be2\u9700\u8981\u7684\u7ea6\u675f<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App\\Scopes;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Scope;<br \/>\nuse Illuminate\\Database\\Eloquent\\Model;<br \/>\nuse Illuminate\\Database\\Eloquent\\Builder;<\/p>\n<p>class AgeScope implements Scope<br \/>\n{<\/p>\n<p>public function apply(Builder $builder, Model $model)<br \/>\n{<br \/>\nreturn $builder-&gt;where(&#8216;age&#8217;, &#8216;&gt;&#8217;, 200);<br \/>\n}<br \/>\n}<\/p>\n<p>\u5728\u6a21\u578b\u7684\u4e2d\uff0c\u9700\u8981\u8986\u76d6\u5176boot\u65b9\u6cd5\uff0c\u5728\u8be5\u65b9\u6cd5\u4e2d\u589e\u52a0addGlobalScope<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use App\\Scopes\\AgeScope;<br \/>\nuse Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected static function boot()<br \/>\n{<br \/>\nparent::boot();<\/p>\n<p>static::addGlobalScope(new AgeScope);<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>\u6dfb\u52a0\u5168\u5c40\u4f5c\u7528\u57df\u4e4b\u540e\uff0cUser::all()\u64cd\u4f5c\u5c06\u4f1a\u4ea7\u751f\u5982\u4e0b\u7b49\u4ef7sql<\/p>\n<p>select * from `users` where `age` &gt; 200<\/p>\n<p>\u4e5f\u53ef\u4ee5\u4f7f\u7528\u533f\u540d\u51fd\u6570\u6dfb\u52a0\u5168\u5c40\u7ea6\u675f<br \/>\nstatic::addGlobalScope(&#8216;age&#8217;, function(Builder $builder) {<br \/>\n$builder-&gt;where(&#8216;age&#8217;, &#8216;&gt;&#8217;, 200);<br \/>\n});<\/p>\n<p>\u67e5\u8be2\u4e2d\u8981\u79fb\u9664\u5168\u5c40\u7ea6\u675f\u7684\u9650\u5236\uff0c\u4f7f\u7528withoutGlobalScope\u65b9\u6cd5<\/p>\n<p>\/\/ \u53ea\u79fb\u9664age\u7ea6\u675f<br \/>\nUser::withoutGlobalScope(&#8216;age&#8217;)-&gt;get();<br \/>\nUser::withoutGlobalScope(AgeScope::class)-&gt;get();<br \/>\n\/\/ \u79fb\u9664\u6240\u6709\u7ea6\u675f<br \/>\nUser::withoutGlobalScopes()-&gt;get();<br \/>\n\/\/ \u79fb\u9664\u591a\u4e2a\u7ea6\u675f<br \/>\nUser::withoutGlobalScopes([FirstScope::class, SecondScope::class])-&gt;get();<\/p>\n<h2>\u672c\u5730\u4f5c\u7528\u57df<\/h2>\n<p>\u672c\u5730\u4f5c\u7528\u57df\u53ea\u5bf9\u90e8\u5206\u67e5\u8be2\u6dfb\u52a0\u7ea6\u675f\uff0c\u9700\u8981\u624b\u52a8\u6307\u5b9a\u662f\u5426\u6dfb\u52a0\u7ea6\u675f\uff0c\u5728\u6a21\u578b\u4e2d\u6dfb\u52a0\u7ea6\u675f\u65b9\u6cd5\uff0c\u4f7f\u7528\u524d\u7f00scope<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>public function scopePopular($query)<br \/>\n{<br \/>\nreturn $query-&gt;where(&#8216;votes&#8217;, &#8216;&gt;&#8217;, 100);<br \/>\n}<br \/>\npublic function scopeActive($query)<br \/>\n{<br \/>\nreturn $query-&gt;where(&#8216;active&#8217;, 1);<br \/>\n}<br \/>\n}<\/p>\n<p>\u4f7f\u7528\u4e0a\u8ff0\u6dfb\u52a0\u7684\u672c\u5730\u7ea6\u675f\u67e5\u8be2\uff0c\u53ea\u9700\u8981\u5728\u67e5\u8be2\u4e2d\u4f7f\u7528scope\u524d\u7f00\u7684\u65b9\u6cd5\uff0c\u53bb\u6389scope\u524d\u7f00\u5373\u53ef<\/p>\n<p>$users = App\\User::popular()-&gt;active()-&gt;orderBy(&#8216;created_at&#8217;)-&gt;get();<br \/>\n\u672c\u5730\u4f5c\u7528\u57df\u65b9\u6cd5\u662f\u53ef\u4ee5\u63a5\u53d7\u53c2\u6570\u7684<\/p>\n<p>public function scopeOfType($query, $type)<br \/>\n{<br \/>\nreturn $query-&gt;where(&#8216;type&#8217;, $type);<br \/>\n}<br \/>\n\u8c03\u7528\u7684\u65f6\u5019<\/p>\n<p>$users = App\\User::ofType(&#8216;admin&#8217;)-&gt;get();<\/p>\n<h2>\u4e8b\u4ef6<\/h2>\n<p>Eloquent\u6a21\u578b\u4f1a\u89e6\u53d1\u4e0b\u5217\u4e8b\u4ef6<\/p>\n<p>creating, created, updating, updated, saving, saved,deleting, deleted, restoring, restored<\/p>\n<p>\u4f7f\u7528\u573a\u666f<br \/>\n\u5047\u8bbe\u6211\u4eec\u5e0c\u671b\u4fdd\u5b58\u7528\u6237\u7684\u65f6\u5019\u5bf9\u7528\u6237\u8fdb\u884c\u6821\u9a8c\uff0c\u6821\u9a8c\u901a\u8fc7\u540e\u624d\u5141\u8bb8\u4fdd\u5b58\u5230\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u5728\u670d\u52a1\u63d0\u4f9b\u8005\u4e2d\u4e3a\u6a21\u578b\u7684\u4e8b\u4ef6\u7ed1\u5b9a\u76d1\u542c<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App\\Providers;<\/p>\n<p>use App\\User;<br \/>\nuse Illuminate\\Support\\ServiceProvider;<\/p>\n<p>class AppServiceProvider extends ServiceProvider<br \/>\n{<\/p>\n<p>public function boot()<br \/>\n{<br \/>\nUser::creating(function ($user) {<br \/>\nif ( ! $user-&gt;isValid()) {<br \/>\nreturn false;<br \/>\n}<br \/>\n});<br \/>\n}<br \/>\npublic function register()<br \/>\n{<br \/>\n\/\/<br \/>\n}<br \/>\n}<br \/>\n\u4e0a\u8ff0\u670d\u52a1\u63d0\u4f9b\u8005\u5bf9\u8c61\u4e2d\uff0c\u5728\u6846\u67b6\u542f\u52a8\u65f6\u4f1a\u76d1\u542c\u6a21\u578b\u7684creating\u4e8b\u4ef6\uff0c\u5f53\u4fdd\u5b58\u7528\u6237\u4e4b\u95f4\u68c0\u67e5\u7528\u6237\u6570\u636e\u7684\u5408\u6cd5\u6027\uff0c\u5982\u679c\u4e0d\u5408\u6cd5\uff0c\u8fd4\u56defalse\uff0c\u6a21\u578b\u6570\u636e\u4e0d\u4f1a\u88ab\u6301\u4e45\u5316\u5230\u6570\u636e\u3002<\/p>\n<p>\u8fd4\u56defalse\u4f1a\u963b\u6b62\u6a21\u578b\u7684save \/ update\u64cd\u4f5c<\/p>\n<h2>\u5e8f\u5217\u5316<\/h2>\n<p>\u5f53\u6784\u5efaJSON API\u7684\u65f6\u5019\uff0c\u7ecf\u5e38\u4f1a\u9700\u8981\u8f6c\u6362\u6a21\u578b\u548c\u5173\u7cfb\u4e3a\u6570\u7ec4\u6216\u8005json\u3002Eloquent\u63d0\u4f9b\u4e86\u4e00\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u65b9\u4fbf\u7684\u6765\u5b9e\u73b0\u6570\u636e\u7c7b\u578b\u4e4b\u95f4\u7684\u8f6c\u6362\u3002<\/p>\n<h3>\u8f6c\u6362\u6a21\u578b\/\u96c6\u5408\u4e3a\u6570\u7ec4 &#8211; toArray()<\/h3>\n<p>$user = App\\User::with(&#8216;roles&#8217;)-&gt;first();<br \/>\nreturn $user-&gt;toArray();<\/p>\n<p>$users = App\\User::all();<br \/>\nreturn $users-&gt;toArray();<\/p>\n<h3>\u8f6c\u6362\u6a21\u578b\u4e3ajson &#8211; toJson()<\/h3>\n<p>$user = App\\User::find(1);<br \/>\nreturn $user-&gt;toJson();<\/p>\n<p>$user = App\\User::find(1);<br \/>\nreturn (string) $user;<br \/>\n\u9690\u85cf\u5c5e\u6027<br \/>\n\u6709\u65f6\u67d0\u4e9b\u5b57\u6bb5\u4e0d\u5e94\u8be5\u88ab\u5e8f\u5217\u5316\uff0c\u6bd4\u5982\u7528\u6237\u7684\u5bc6\u7801\u7b49\uff0c\u4f7f\u7528$hidden\u5b57\u6bb5\u63a7\u5236\u90a3\u4e9b\u5b57\u6bb5\u4e0d\u5e94\u8be5\u88ab\u5e8f\u5217\u5316<br \/>\n&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected $hidden = [&#8216;password&#8217;];<br \/>\n}<br \/>\n\u9690\u85cf\u5173\u8054\u5173\u7cfb\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u7684\u662f\u5b83\u7684\u65b9\u6cd5\u540d\u79f0\uff0c\u4e0d\u662f\u52a8\u6001\u7684\u5c5e\u6027\u540d<br \/>\n\u4e5f\u53ef\u4ee5\u4f7f\u7528$visible\u6307\u5b9a\u4f1a\u88ab\u5e8f\u5217\u5316\u7684\u767d\u540d\u5355<br \/>\n&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected $visible = [&#8216;first_name&#8217;, &#8216;last_name&#8217;];<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>\u6709\u65f6\u53ef\u80fd\u9700\u8981\u67d0\u4e2a\u9690\u85cf\u5b57\u6bb5\u88ab\u4e34\u65f6\u5e8f\u5217\u5316\uff0c\u4f7f\u7528makeVisible\u65b9\u6cd5<\/p>\n<p>return $user-&gt;makeVisible(&#8216;attribute&#8217;)-&gt;toArray();<\/p>\n<p>&nbsp;<\/p>\n<h3>\u4e3ajson\u8ffd\u52a0\u503c<\/h3>\n<p>\u6709\u65f6\u9700\u8981\u5728json\u4e2d\u8ffd\u52a0\u4e00\u4e9b\u6570\u636e\u5e93\u4e2d\u4e0d\u5b58\u5728\u7684\u5b57\u6bb5\uff0c\u4f7f\u7528\u4e0b\u5217\u65b9\u6cd5\uff0c\u73b0\u5728\u6a21\u578b\u4e2d\u589e\u52a0\u4e00\u4e2aget\u65b9\u6cd5<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected $appends = [&#8216;is_admin&#8217;];<\/p>\n<p>public function getIsAdminAttribute()<br \/>\n{<br \/>\nreturn $this-&gt;attributes[&#8216;admin&#8217;] == &#8216;yes&#8217;;<br \/>\n}<br \/>\n}<br \/>\n\u65b9\u6cd5\u7b7e\u540d\u4e3agetXXXAttribute\u683c\u5f0f\uff0c\u7136\u540e\u4e3a\u6a21\u578b\u7684$appends\u5b57\u6bb5\u8bbe\u7f6e\u5b57\u6bb5\u540d\u3002<\/p>\n<h3>Mutators<\/h3>\n<p>\u5728Eloquent\u6a21\u578b\u4e2d\uff0cAccessor\u548cMutator\u53ef\u4ee5\u7528\u6765\u5bf9\u6a21\u578b\u7684\u5c5e\u6027\u8fdb\u884c\u5904\u7406\uff0c\u6bd4\u5982\u6211\u4eec\u5e0c\u671b\u5b58\u50a8\u5230\u8868\u4e2d\u7684\u5bc6\u7801\u5b57\u6bb5\u8981\u7ecf\u8fc7\u52a0\u5bc6\u624d\u884c\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Laravel\u7684\u52a0\u5bc6\u5de5\u5177\u81ea\u52a8\u7684\u5bf9\u5b83\u8fdb\u884c\u52a0\u5bc6\u3002<\/p>\n<h3>Accessors &amp; Mutators<br \/>\naccessors<\/h3>\n<p>\u8981\u5b9a\u4e49\u4e00\u4e2aaccessor\uff0c\u9700\u8981\u5728\u6a21\u578b\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u79f0\u4e3agetXxxAttribute\u7684\u65b9\u6cd5\uff0c\u5176\u4e2d\u7684Xxx\u662f\u9a7c\u5cf0\u547d\u540d\u6cd5\u7684\u5b57\u6bb5\u540d\u3002<\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5b57\u6bb5\u662ffirst_name\uff0c\u5f53\u6211\u4eec\u5c1d\u8bd5\u53bb\u83b7\u53d6first_name\u7684\u503c\u7684\u65f6\u5019\uff0cgetFirstNameAttribute\u65b9\u6cd5\u5c06\u4f1a\u88ab\u81ea\u52a8\u7684\u8c03\u7528<br \/>\n&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>public function getFirstNameAttribute($value)<br \/>\n{<br \/>\nreturn ucfirst($value);<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u8bbf\u95ee\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u6b63\u5e38\u7684\u8bbf\u95ee\u5c5e\u6027\u5c31\u53ef\u4ee5<\/p>\n<p>$user = App\\User::find(1); $firstName = $user-&gt;first_name;<\/p>\n<p>&nbsp;<\/p>\n<h3>mutators<\/h3>\n<p>&nbsp;<\/p>\n<p>\u521b\u5efamutators\u4e0eaccessorsl\u7c7b\u4f3c\uff0c\u521b\u5efa\u540d\u4e3asetXxxAttribute\u7684\u65b9\u6cd5\u5373\u53ef<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>public function setFirstNameAttribute($value)<br \/>\n{<br \/>\n$this-&gt;attributes[&#8216;first_name&#8217;] = strtolower($value);<br \/>\n}<br \/>\n}<br \/>\n\u8d4b\u503c\u65b9\u5f0f<\/p>\n<p>$user = App\\User::find(1);<br \/>\n$user-&gt;first_name = &#8216;Sally&#8217;;<\/p>\n<h3>\u5c5e\u6027\u8f6c\u6362<\/h3>\n<p>\u6a21\u578b\u7684$casts\u5c5e\u6027\u63d0\u4f9b\u4e86\u4e00\u79cd\u975e\u5e38\u7b80\u4fbf\u7684\u65b9\u5f0f\u8f6c\u6362\u5c5e\u6027\u4e3a\u5e38\u89c1\u7684\u6570\u636e\u7c7b\u578b\uff0c\u5728\u6a21\u578b\u4e2d\uff0c\u4f7f\u7528$casts\u5c5e\u6027\u5b9a\u4e49\u4e00\u4e2a\u6570\u7ec4\uff0c\u8be5\u6570\u7ec4\u7684key\u4e3a\u8981\u8f6c\u6362\u7684\u5c5e\u6027\u540d\u79f0\uff0cvalue\u4e3a\u8f6c\u6362\u7684\u6570\u636e\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301integer, real, float, double, string, boolean, object, array,collection, date, datetime, \u548c timestamp\u3002<\/p>\n<p>&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected $casts = [<br \/>\n&#8216;is_admin&#8217; =&gt; &#8216;boolean&#8217;,<br \/>\n];<br \/>\n}<br \/>\n\u6570\u7ec4\u7c7b\u578b\u7684\u8f6c\u6362\u65f6\u975e\u5e38\u6709\u7528\u7684\uff0c\u6211\u4eec\u5728\u6570\u636e\u5e93\u4e2d\u5b58\u50a8json\u6570\u636e\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u5c06\u5176\u8f6c\u6362\u4e3a\u6570\u7ec4\u5f62\u5f0f\u3002<br \/>\n&lt;?php<\/p>\n<p>namespace App;<\/p>\n<p>use Illuminate\\Database\\Eloquent\\Model;<\/p>\n<p>class User extends Model<br \/>\n{<\/p>\n<p>protected $casts = [<br \/>\n&#8216;options&#8217; =&gt; &#8216;array&#8217;,<br \/>\n];<br \/>\n}<br \/>\n\u4ece\u914d\u7f6e\u6570\u7ec4\u8f6c\u6362\u7684\u5c5e\u6027\u53d6\u503c\u6216\u8005\u8d4b\u503c\u7684\u65f6\u5019\u90fd\u4f1a\u81ea\u52a8\u7684\u5b8c\u6210json\u548carray\u7684\u8f6c\u6362<\/p>\n<p>$user = App\\User::find(1);<br \/>\n$options = $user-&gt;options;<br \/>\n$options[&#8216;key&#8217;] = &#8216;value&#8217;;<br \/>\n$user-&gt;options = $options;<br \/>\n$user-&gt;save();<br \/>\n\u53c2\u8003\uff1a<\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><a href=\"https:\/\/laravel.com\/docs\/5.2\/eloquent\"><span class=\"s2\">Eloquent: Getting Started<\/span><\/a><\/span><\/li>\n<li class=\"li1\"><span class=\"s3\"><a href=\"https:\/\/laravel.com\/docs\/5.2\/eloquent-serialization\"><span class=\"s4\">Eloquent: Serialization<\/span><\/a><\/span><\/li>\n<li class=\"li1\"><span class=\"s3\"><a href=\"https:\/\/laravel.com\/docs\/5.2\/eloquent-mutators\"><span class=\"s4\">Eloquent: Mutators<\/span><\/a><\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u8be2\u4f5c\u7528\u57df \u5168\u5c40\u4f5c\u7528\u57df \u5168\u5c40\u4f5c\u7528\u57df\u5141\u8bb8\u4f60\u5bf9\u7ed9\u5b9a\u6a21\u578b\u7684\u6240\u6709\u67e5\u8be2\u6dfb\u52a0\u7ea6\u675f&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[167,36],"class_list":["post-1161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-Php","tag-laravel","tag-php-2"],"_links":{"self":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1161"}],"version-history":[{"count":6,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1161\/revisions"}],"predecessor-version":[{"id":1179,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/1161\/revisions\/1179"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/media\/1159"}],"wp:attachment":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}