{"flag":true,"single":true,"pageTitle":"Relationships in laravel","post":{"id":14,"user_id":"1","slug":"relationships-in-laravel-slvk","title":"Relationships in laravel","body":"<p>Get data from multiple tables&nbsp;<\/p>\r\n<p>we have two tables <strong>profiles<\/strong><\/p>\r\n<table class=\"table_results ajax pma_table\" style=\"color: #444444; font-family: sans-serif; font-size: 13.12px; background-color: #ffffff;\" data-uniqueid=\"249707199\">\r\n<thead style=\"box-sizing: border-box;\">\r\n<tr style=\"box-sizing: border-box;\">\r\n<th class=\"draggable right\" style=\"box-sizing: border-box; text-align: right; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 1em 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"id\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 0px;\">id<\/span><\/th>\r\n<th class=\"draggable right\" style=\"box-sizing: border-box; text-align: right; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 1em 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"user_id\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 0px;\">user_id<\/span><\/th>\r\n<th class=\"draggable\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"phone\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\">phone<\/span><\/th>\r\n<th class=\"draggable\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"address\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\">address<\/span><\/th>\r\n<th class=\"draggable\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"created_at\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\">created_at<\/span><\/th>\r\n<th class=\"draggable\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"updated_at\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\">updated_at<\/span><\/th>\r\n<\/tr>\r\n<\/thead>\r\n<\/table>\r\n<p>And <strong>users<\/strong><\/p>\r\n<div class=\"cRsz\" style=\"box-sizing: border-box; position: absolute; color: #444444; font-family: sans-serif; font-size: 13.12px; background-color: #ffffff; height: 395.781px;\">\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 236.813px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 313.938px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 470px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 599.673px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 989.375px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 1382.95px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 1512.63px;\">&nbsp;<\/div>\r\n<div class=\"colborder\" style=\"box-sizing: border-box; cursor: col-resize; height: 395.766px; margin-left: -6px; position: absolute; width: 5px; left: 1642.3px;\">&nbsp;<\/div>\r\n<\/div>\r\n<table class=\"table_results ajax pma_table\" style=\"color: #444444; font-family: sans-serif; font-size: 13.12px; background-color: #ffffff;\" data-uniqueid=\"436911974\">\r\n<thead style=\"box-sizing: border-box;\">\r\n<tr style=\"box-sizing: border-box;\">\r\n<th class=\"column_action print_ignore\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff;\" colspan=\"4\">&nbsp;<\/th>\r\n<th class=\"draggable right column_heading pointer marker\" style=\"box-sizing: border-box; text-align: right; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 1em 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff;\" data-column=\"id\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 0px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60id%60+ASC&amp;sql_signature=6ebc6a0ac1a5966dbdcbbf83be2769469cff0629de8640fab1ddf9d0e992691a&amp;session_max_rows=25&amp;is_browse_distinct=0\">id<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"name\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60name%60+ASC&amp;sql_signature=1eca3d001f17c45866a1c40bc254839cf5e0a6991fa33a6ec2660c8243d63e2b&amp;session_max_rows=25&amp;is_browse_distinct=0\">name<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"email\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60email%60+ASC&amp;sql_signature=207b0e15bb2b12f842dc32ba2f1d27341b868b2f3a448a40a1b4aaa1909b4b1c&amp;session_max_rows=25&amp;is_browse_distinct=0\">email<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"email_verified_at\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60email_verified_at%60+DESC&amp;sql_signature=3a3cff1850701f4a3620185ab99d853ae033d6c7c66a162e05159bfb2b9518c8&amp;session_max_rows=25&amp;is_browse_distinct=0\">email_verified_at<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"password\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60password%60+ASC&amp;sql_signature=efe86a78741e4e3edc12c8ddb15d23cce371bc9abc012e8d0e89954ce0146c54&amp;session_max_rows=25&amp;is_browse_distinct=0\">password<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"remember_token\" aria-describedby=\"ui-id-24\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60remember_token%60+ASC&amp;sql_signature=58c9a8aa677aadf03d7c4e1f648810f7491c0f14716edeab2e5bf45a40ae6eb3&amp;session_max_rows=25&amp;is_browse_distinct=0\">remember_token<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"created_at\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60created_at%60+DESC&amp;sql_signature=4208a89364e21f9cd4c5879190e7019d4459e29404ff72c3645af7206a7bca75&amp;session_max_rows=25&amp;is_browse_distinct=0\">created_at<\/a><\/span><\/th>\r\n<th class=\"draggable column_heading pointer marker\" style=\"box-sizing: border-box; text-align: left; color: #000000; background: linear-gradient(#ffffff, #cccccc); padding: 0.1em 0.3em; margin: 0.1em; vertical-align: middle; text-shadow: #ffffff 0px 1px 0px; border-right-color: #ffffff; cursor: move;\" data-column=\"updated_at\"><span style=\"box-sizing: border-box; display: block; overflow: hidden; margin-right: 10px;\"><a class=\"sortlink\" style=\"box-sizing: border-box; color: #235a81; text-decoration-line: none; background-color: transparent; cursor: pointer; outline: none;\" href=\"http:\/\/localhost\/phpmyadmin\/sql.php?db=laravel&amp;table=users&amp;sql_query=SELECT+%2A+FROM+%60users%60++%0AORDER+BY+%60users%60.%60updated_at%60+DESC&amp;sql_signature=2bacf4a43e12fa013b168366a11900ccf1d53c6a15f427576972dedb0662b16c&amp;session_max_rows=25&amp;is_browse_distinct=0\">updated_at<\/a><\/span><\/th>\r\n<\/tr>\r\n<\/thead>\r\n<\/table>\r\n<p>Add a new function in model <strong>app\\Models\\User.php<\/strong><\/p>\r\n<p><strong>SYNTAX:&nbsp;<\/strong><\/p>\r\n<pre class=\"language-javascript\"><code>return $this-&gt;hasOne(Phone::class, 'foreign_key', 'local_key');\r\n\/\/FOREIGN KEY MEANS key of Phone model,<\/code><\/pre>\r\n<pre class=\"language-markup\"><code>public function profile(){\r\n\treturn $this-&gt;hasOne(profile::class); \/\/each user has only one profile OR\r\n       \/\/ return $this-&gt;hasOne(profile::class, 'user_id'); \/\/forigen key specify\r\n      \/\/return $this-&gt;hasOne(profile::class, 'user_id', 'phone'); \/\/multiple foregin keys\r\n}<\/code><\/pre>\r\n<p>In <strong>HomeController.php <\/strong>add below code and add <strong>use App\\Models\\User;<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function getRelationship(){\r\n\t$data = User::with('profile')-&gt;get(); \/\/profile function in user model\r\n\treturn $data;\r\n}<\/code><\/pre>\r\n<p>profile is method in User Model<\/p>\r\n<p><strong>Web.php<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>Route::get('getRelationship', [App\\Http\\Controllers\\HomeController::class, 'getRelationship'])-&gt;name('getRelationship');<\/code><\/pre>\r\n<p>Visit URL <strong>http:\/\/127.0.0.1:8000\/getRelationship<\/strong> you will get<\/p>\r\n<pre class=\"language-markup\"><code>[\r\n  {\r\n    \"id\": 1,\r\n    \"name\": \"Rizwan\",\r\n    \"email\": \"rizwan@gmail.com\",\r\n    \"email_verified_at\": \"2022-01-15T21:42:35.000000Z\",\r\n    \"created_at\": \"2022-01-15T21:10:18.000000Z\",\r\n    \"updated_at\": \"2022-01-15T21:45:23.000000Z\",\r\n    \"profile\": {\r\n      \"id\": 1,\r\n      \"user_id\": 1,\r\n      \"phone\": \"923461234567\",\r\n      \"address\": \"kmw\",\r\n      \"created_at\": null,\r\n      \"updated_at\": null\r\n    }\r\n  },\r\n  {\r\n    \"id\": 2,\r\n    \"name\": \"muhammad yaser\",\r\n    \"email\": \"filereal@live.com\",\r\n    \"email_verified_at\": \"2022-01-15T23:29:27.000000Z\",\r\n    \"created_at\": \"2022-01-15T23:29:09.000000Z\",\r\n    \"updated_at\": \"2022-01-15T23:29:27.000000Z\",\r\n    \"profile\": null\r\n  }\r\n]<\/code><\/pre>\r\n<p><strong>INVERSE RELATION:<\/strong><\/p>\r\n<p>INVERSE RELATIONSHIP &gt;&gt; IN <strong>Profile<\/strong> MODEL USE&nbsp;<\/p>\r\n<pre class=\"language-markup\"><code>public function user()\r\n    {\r\n        return $this-&gt;belongsTo(User::class);\r\n    }<\/code><\/pre>\r\n<p>Then you can get profile with user details<\/p>\r\n<pre class=\"language-markup\"><code>$data = Profile::with('user')-&gt;get(); \/\/profile function in user model<\/code><\/pre>\r\n<p>user is method in profile model,&nbsp;<\/p>\r\n<p>___________________________<\/p>\r\n<p>You can also get records by <strong>profiles<\/strong> relationship<\/p>\r\n<p><strong>profile.php model<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function user(){\r\n\t\treturn $this-&gt;belongsTo(user::class); \/\/each user has only one profile\r\n\t}<\/code><\/pre>\r\n<p><strong>Controller.php <\/strong>with use <strong>App\\Models\\Profile;<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function getRelationship(){\r\n\t\t$data = Profile::with('user')-&gt;get(); \/\/profile function in user model\r\n\t\treturn $data;\r\n\t}<\/code><\/pre>\r\n<p>Similarly You can make <strong>one to many<\/strong> relationships<\/p>\r\n<p>For details visit&nbsp;<a href=\"https:\/\/laravel.com\/docs\/8.x\/eloquent-relationships\">Eloquent: Relationships - Laravel - The PHP Framework For Web Artisans<\/a><\/p>\r\n<p>______________________________________<\/p>\r\n<p><strong>A user has many phones, Get all phone numbers of a user that have id 1<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function phone()\r\n    {\r\n        return $this-&gt;hasMany(PhoneNumber::class);\r\n    }<\/code><\/pre>\r\n<p>and then call in <strong>User controller<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>$user = \\App\\Models\\User::find(1)-&gt;phone-&gt;toArray();<\/code><\/pre>\r\n<p>For pagination&nbsp;<\/p>\r\n<p><strong>ONE TO MANY<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>class Post extends Model\r\n{\r\n    public function comments()\r\n    {\r\n        return $this-&gt;hasMany(Comment::class);\r\n    }\r\n}<\/code><\/pre>\r\n<p>then call it<\/p>\r\n<pre class=\"language-markup\"><code>$comments = Post::find(1)-&gt;comments;<\/code><\/pre>\r\n<p><strong>ONE TO MANY INVERSE<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>class Comment extends Model\r\n{\r\n    public function post()\r\n    {\r\n        return $this-&gt;belongsTo(Post::class);\r\n    }\r\n}<\/code><\/pre>\r\n<p>Then in controller<\/p>\r\n<pre class=\"language-markup\"><code>$comment = Comment::find(1);\r\nreturn $comment-&gt;post-&gt;title;<\/code><\/pre>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>Relationships:<\/strong><\/p>\r\n<p><strong>ONE TO ONE:<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>$this-&gt;hasOne(Phone::class,); \/\/a user have one phone<\/code><\/pre>\r\n<p><strong>One To Many<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>$this-&gt;hasMany(Comment::class); \/\/ A post contain many comments<\/code><\/pre>\r\n<p>Will get one post and its all comments but comments will pagination of 5 per page<\/p>\r\n<pre class=\"language-markup\"><code>$post_details= \\App\\Models\\Post::with(['Comment' =&gt; function ($query) {\r\n                $query-&gt;paginate(5);\r\n            }])\r\n            -&gt;take(1)\r\n            -&gt;first();<\/code><\/pre>\r\n<p><strong>Has One Of Many<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>$this-&gt;hasOne(Order::class)-&gt;latestOfMany(); \/\/latest order\r\n$this-&gt;hasOne(Order::class)-&gt;oldestOfMany(); \/\/old order\r\n$this-&gt;hasOne(Order::class)-&gt;ofMany('price', 'max'); \/\/expensive order<\/code><\/pre>\r\n<p><strong>Has one through:&nbsp;<\/strong><strong>hasOneThrough<\/strong><\/p>\r\n<p><strong>3 models , ie car, owner and mechanic&nbsp;<\/strong><\/p>\r\n<p><strong>mechanics:<\/strong> id,name<\/p>\r\n<p><strong>cars<\/strong><strong>: <\/strong>id,model,mechanic_id<\/p>\r\n<p><strong>owners: <\/strong>id, name,&nbsp;car_id<\/p>\r\n<pre class=\"language-markup\"><code>class Mechanic extends Model\r\n{\r\n    public function carOwner()\r\n    { \/\/ Get the car's owner. using card in between mechanic and owner\r\n        return $this-&gt;hasOneThrough(Owner::class, Car::class);\r\n    }\r\n}<\/code><\/pre>\r\n<p><strong>Has Many Through:&nbsp;<\/strong><strong>hasManyThrough<\/strong><\/p>\r\n<p><strong>projects: <\/strong>id, name<\/p>\r\n<p><strong>environments: <\/strong>id, project_id, name<\/p>\r\n<p><strong>deployments:<\/strong> id, environment_id, commit_hash<\/p>\r\n<pre class=\"language-markup\"><code>class Project extends Model\r\n{\r\n     \/\/ Get all of the deployments for the project.\r\n    public function deployments()\r\n    {\r\n        return $this-&gt;hasManyThrough(Deployment::class, Environment::class);\r\n    }\r\n}<\/code><\/pre>\r\n<p><strong>Many to Many: ?<\/strong><\/p>\r\n<p>&nbsp;<\/p>","category_id":"2","is_private":"0","created_at":"2023-03-14T04:19:24.000000Z","updated_at":"2023-07-24T07:32:24.000000Z","category":{"id":2,"user_id":"1","name":"Laravel Core","slug":"laravel-nhyt","parent_id":"1","created_at":"2023-03-14T03:58:27.000000Z","updated_at":"2023-03-20T11:30:50.000000Z"},"user":{"id":1,"name":"R GONDAL","email":"rizikmw@gmail.com","email_verified_at":null,"two_factor_confirmed_at":null,"current_team_id":"1","profile_photo_path":null,"created_at":"2023-03-12T10:49:33.000000Z","updated_at":"2025-01-10T12:59:00.000000Z","profile_photo_url":"https:\/\/ui-avatars.com\/api\/?name=R+G&color=7F9CF5&background=EBF4FF"}},"pageDesc":"Get data from multiple tables&nbsp; we have two tables profiles    id user_id phone address created_at updated_at    And users  &nbsp; &nbsp - Relationships in laravel (Updated: July 24, 2023) - Read more about Relationships in laravel at my programming site [SITE]","categories":[]}