{"id":3656,"date":"2020-12-22T04:15:50","date_gmt":"2020-12-22T04:15:50","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=3656"},"modified":"2020-12-22T04:41:05","modified_gmt":"2020-12-22T04:41:05","slug":"eloquent-relationships","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/eloquent-relationships\/","title":{"rendered":"Eloquent: Relationships"},"content":{"rendered":"<p>Database tables are often related to one another. For example, a student in college could have several subjects, a bank account is related to the user who owns that. Eloquent makes managing and dealing with these relationships straight-forward and supports many different types of relationships:<\/p>\n<ol>\n<li>One To One<\/li>\n<li>One To Many<\/li>\n<li>Many To Many D(2<\/li>\n<li>Has One Through<\/li>\n<li>Has Many Through<\/li>\n<li>One To One (Polymorphic)<\/li>\n<li>One To Many (Polymorphic)<\/li>\n<li>Many To Many (Polymorphic)<\/li>\n<\/ol>\n<h2>One To One<\/h2>\n<p>A one-to-one relationship is a very basic relation. For example, a person has only one car which belongs to its owner.<br \/>\nExample: We have 2 models (<strong>OWNER<\/strong> and <strong>CAR<\/strong>) and two tables (<strong>owners<\/strong> and <strong>cars<\/strong>). Car belongs to one owner or the owner has only one car. <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/db1.png\" alt=\"db1 relationships\"\/><\/p>\n<p>The car table should have <strong>ownerID <\/strong>in it.<br \/>\n<code>Eloquent Model:<br \/>\nOwner Model:<br \/>\nclass Owner<br \/>\n{<br \/>\n   public function car()<br \/>\n   {<br \/>\n      return $this->hasOne(Car::class);<br \/>\n   }<br \/>\n}<br \/>\nCar model:<br \/>\nclass Car<br \/>\n{<br \/>\n   public function owner()<br \/>\n   {<br \/>\n       return $this->belongsTo(Owner::class);<br \/>\n   }<br \/>\n}<br \/>\nDatabase Migrations:<br \/>\nOwner Schema:<br \/>\nSchema::create('owners', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nCars Schema :<br \/>\nSchema::create('cars', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');    $table->integer('owner_id')->unsigned()->index()->nullable();<br \/>\n   $table->foreign('owner_id')->references('id')->on('owners');<br \/>\n});<\/code><\/p>\n<p>Additionally, eloquent assumes that the foreign key should have a worth value matching the id (or the custom $primaryKey) column of the parent. In alternative words, eloquent can seek for the value of the user&#8217;s id column within the user_id column of the Phone record. If you&#8217;d just like the relationship to use a price apart from id, you&#8217;ll pass the 3rd argument to the hasOne technique specifying your custom key:<br \/>\n<code>return $this->hasOne('App\\Car', 'foreign_key', 'local_key');<\/code>\t<\/p>\n<h3>One To Many<\/h3>\n<p>A one-to-many relationship defines the relationships where a single model has any amount of other models.<br \/>\nExample: We have 2 models (<strong>Thief<\/strong> and <strong>CAR<\/strong>) and two tables (<strong>thieves <\/strong>and <strong>cars<\/strong>). A thief can steal many cars or a car can be stolen by one thief.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/db2.png\" alt=\"db2 relationships\"\/><\/p>\n<p>The Cars table should store the <strong>thiefId<\/strong>.<br \/>\n<code>Eloquent Model:<br \/>\nThief Model :<br \/>\nclass Thief<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n      return $this->hasMany(Car::class);<br \/>\n   }<br \/>\n}<br \/>\nCar model:<br \/>\nclass Car<br \/>\n{<br \/>\n   public function thief()<br \/>\n   {<br \/>\n       return $this->belongsTo(Thief::class);<br \/>\n   }<br \/>\n}<br \/>\nDatabase Migrations:<br \/>\nThief Schema:<br \/>\nSchema::create('thieves', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nCars Schema:<br \/>\nSchema::create('cars', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n   $table->integer('thief_id')->unsigned()->index()->nullable();<br \/>\n   $table->foreign('thief_id')->references('id')->on('thieves');<br \/>\n});<\/code><br \/>\nLike the <strong>hasOne<\/strong> method, you may also override the <strong>foreign <\/strong>and <strong>local keys<\/strong> by passing additional arguments to the <strong>hasMany<\/strong> method.<\/p>\n<h3>Many To Many<\/h3>\n<p>Many-to-many relations are slightly more complicated than <strong>hasOne<\/strong> and <strong>hasMany <\/strong>relationships. An example of such a relationship is a user with many roles, where the roles are also shared by other users.<br \/>\nExample: We have 2 models (<strong>Driver<\/strong> and <strong>Car<\/strong>), and 3 tables (drivers, cars and a pivot table named <strong>car_driver<\/strong>).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/db3.png\" alt=\"db3\"\/><br \/>\nThe <strong>Pivot<\/strong> table \u201ccar_driver\u201d should store the <strong>driverId <\/strong>and the <strong>carId<\/strong>.<br \/>\n<code>Eloquent Model:<br \/>\nDriver Model:<br \/>\nclass Driver<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n      return $this->belongsToMany(Car::class);<br \/>\n   }<br \/>\n}<br \/>\nCar model:<br \/>\nclass Car<br \/>\n{<br \/>\n   public function thief()<br \/>\n   {<br \/>\n       return $this->belongsToMany(Driver::class);<br \/>\n   }<br \/>\n}<br \/>\nDatabase Migrations:<br \/>\nDriver Schema:<br \/>\nSchema::create('drivers', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nCars Schema:<br \/>\nSchema::create('cars', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nPivot Schema:<br \/>\nSchema::create('car_driver', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->integer('car_id')->unsigned()->index();<br \/>\n   $table->foreign('car_id')->references('id')->on('cars')->onDelete('cascade');<br \/>\n   $table->integer('driver_id')->unsigned()->index();<br \/>\n   $table->foreign('driver_id')->references('id')->on('drivers')->onDelete('cascade');<br \/>\n});<\/code><\/p>\n<h3>One To Many (Polymorphic)<\/h3>\n<p>A <strong>polymorphic relationship<\/strong> makes it possible for the target model that it can belong to one or more than one type of model using a single association. A <strong>one-to-many polymorphic<\/strong> relation is the same as that of simple one-to-one relation. However, the target model can belong to more than one type of model on a single association. For example, we have 3 models (Man, Woman, and Car) and 3 tables (men, women, and cars).<\/p>\n<ul>\n<li>The Man (buyer) can buy many Cars.<\/li>\n<li>The Woman (buyer) can buy many Cars.<\/li>\n<li>One buyer (Man or Woman) can buy the Car.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/db4.png\" alt=\"db4\"\/><br \/>\n<code>Eloquent Model:<br \/>\nMan Model:<br \/>\nclass Man<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n       return $this->morphMany(Car::class, 'buyer');<br \/>\n   }<br \/>\n}<br \/>\nWoman model:<br \/>\nclass Woman<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n       return $this->morphMany(Car::class, 'buyer');<br \/>\n   }<br \/>\n}<br \/>\nWoman model:<br \/>\nclass Car<br \/>\n{<br \/>\n   public function buyer()<br \/>\n   {<br \/>\n       return $this->morphTo();<br \/>\n   }<br \/>\n}<br \/>\nDatabase Migrations:<br \/>\nMen Schema:<br \/>\nSchema::create('men', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nWomen Schema:<br \/>\nSchema::create('women', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nCars Schema:<br \/>\nSchema::create('cars', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');    $table->integer('buyer_id')->unsigned()->index()->nullable();<br \/>\n   $table->string('buyer_type')->nullable();<br \/>\n   \/\/ or use $table->morphs(\u2018buyer\u2019); instead of \"buyer_id\" and \"buyer_type\"<br \/>\n});<\/code><\/p>\n<h3>One To Many (Polymorphic)<\/h3>\n<p>A one-to-many polymorphic relation is similar to a simple one-to-many relationship. However, the target model can belong to more than one type of model on a single association. For example, we have 3 models (<strong>Valet<\/strong>, <strong>Owner<\/strong>, and <strong>Car<\/strong>), and 4 tables (<strong>valets, owners, cars<\/strong> and drivers). <\/p>\n<ul>\n<li>The Valet (driver) can drive many Cars.<\/li>\n<li>The Owner (driver) can drive many Cars.<\/li>\n<li>There can be many drivers (Valet or\/and Owner) for one Car.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/db5.png\" alt=\"db5\"\/><br \/>\n<code>Eloquent Model:<br \/>\nValet Model:<br \/>\nclass Valet<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n       return $this->morphToMany(Car::class, 'driver');<br \/>\n   }<br \/>\n}<br \/>\nOwner model:<br \/>\nclass Owner<br \/>\n{<br \/>\n   public function cars()<br \/>\n   {<br \/>\n       return $this->morphToMany(Car::class, 'driver');<br \/>\n   }<br \/>\n}<br \/>\nCar model:<br \/>\nclass Car<br \/>\n{<br \/>\n   public function valets()<br \/>\n   {<br \/>\n       return $this->morphedByMany(Valet::class, 'driver');<br \/>\n   }<\/p>\n<p>   public function owners()<br \/>\n   {<br \/>\n       return $this->morphedByMany(Owner::class, 'driver');<br \/>\n   }<br \/>\n}<br \/>\nDatabase Migrations:<br \/>\nValets Schema:<br \/>\nSchema::create('valets', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nOwners Schema:<br \/>\nSchema::create('owners', function (Blueprint $table) {<br \/>\n   $table->increments('id');<br \/>\n   $table->string('name');<br \/>\n});<br \/>\nDrivers Schema:<br \/>\nSchema::create('drivers', function (Blueprint $table) {<br \/>\n   $table->increments('id');    $table->integer('driver_id')->unsigned()->index();<br \/>\n   $table->string('driver_type');<br \/>\n   \/\/ or use $table->morphs(\u2018driver\u2019); instead of \"driver_id\" and \"driver_type\"                                                                                                                                                                                                                                                    $table->integer('car_id')->unsigned()->index();<br \/>\n   $table->foreign('car_id')->references('id')->on('cars')->onDelete('cascade');<br \/>\n});<\/code><\/p>\n<p><small><em>Get certification for your knowledge in the fundamentals of Computer functioning by clearing the Computer Certification exam conducted by StudySection. After going through this <a href=\"https:\/\/www.studysection.com\/computer-applications-diploma\">Computer Certification Exam<\/a>, you will be able to evaluate your basic knowledge of computers.<\/em><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Database tables are often related to one another. For example, a student in college could have several subjects, a bank<\/p>\n","protected":false},"author":1,"featured_media":3657,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[149,608],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>StudySection Blog - Eloquent: Database Tables Relationships<\/title>\n<meta name=\"description\" content=\"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"StudySection Blog - Eloquent: Database Tables Relationships\" \/>\n<meta property=\"og:description\" content=\"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-22T04:15:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-22T04:41:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/relation.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Eloquent: Relationships\",\"datePublished\":\"2020-12-22T04:15:50+00:00\",\"dateModified\":\"2020-12-22T04:41:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\"},\"wordCount\":555,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"database\",\"Relationships\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/eloquent-relationships\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\",\"url\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\",\"name\":\"StudySection Blog - Eloquent: Database Tables Relationships\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2020-12-22T04:15:50+00:00\",\"dateModified\":\"2020-12-22T04:41:05+00:00\",\"description\":\"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/eloquent-relationships\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/eloquent-relationships\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Eloquent: Relationships\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"StudySection Blog - Eloquent: Database Tables Relationships","description":"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.","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:\/\/studysection.com\/blog\/eloquent-relationships\/","og_locale":"en_US","og_type":"article","og_title":"StudySection Blog - Eloquent: Database Tables Relationships","og_description":"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.","og_url":"https:\/\/studysection.com\/blog\/eloquent-relationships\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2020-12-22T04:15:50+00:00","article_modified_time":"2020-12-22T04:41:05+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2020\/12\/relation.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Eloquent: Relationships","datePublished":"2020-12-22T04:15:50+00:00","dateModified":"2020-12-22T04:41:05+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/"},"wordCount":555,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["database","Relationships"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/eloquent-relationships\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/","url":"https:\/\/studysection.com\/blog\/eloquent-relationships\/","name":"StudySection Blog - Eloquent: Database Tables Relationships","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2020-12-22T04:15:50+00:00","dateModified":"2020-12-22T04:41:05+00:00","description":"Database tables often have relationships to each another. Like a student has several subjects, a bank is related to the user who owns that.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/eloquent-relationships\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/eloquent-relationships\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Eloquent: Relationships"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":444,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/3656"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=3656"}],"version-history":[{"count":2,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/3656\/revisions"}],"predecessor-version":[{"id":3664,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/3656\/revisions\/3664"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/3657"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=3656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=3656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=3656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}