{"id":18409,"date":"2020-09-07T08:23:07","date_gmt":"2020-09-07T08:23:07","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=18409"},"modified":"2021-10-29T06:40:01","modified_gmt":"2021-10-29T06:40:01","slug":"how-to-merge-two-or-multiple-tables-to-each-other-in-the-laravel-php-framework-part-2","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-merge-two-or-multiple-tables-to-each-other-in-the-laravel-php-framework-part-2\/","title":{"rendered":"How to merge two or multiple tables to each other in the Laravel PHP Framework? (Part-2)"},"content":{"rendered":"\n<p>How to merge two or multiple tables to each other in the Laravel PHP Framework?<\/p>\n\n\n\n<p><a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-merge-two-or-multiple-tables-to-each-other-in-the-laravel-php-framework-part-1\/\">Part-1<\/a> <a href=\"https:\/\/www.devopsschool.com\/blog\/how-to-merge-two-or-multiple-tables-to-each-other-in-the-laravel-php-framework-part-3\/\">Part-3<\/a><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\"><strong>Step 1.<\/strong> <\/span><strong>Go<\/strong> to <strong>app\/Country.php<\/strong>. Now, we need to list all the properties we need in the $fillable array.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/ushakiran27\/f340c1b8b59d9069c4bfd1e5d7b959f9.js\"><\/script>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Step 2.<\/span><\/strong> <strong>Go <\/strong>to <strong>app\/Http\/Controllers\/CountryController.php <\/strong>file.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/ushakiran27\/e412fe251f954e73493b15e210ab27b4.js\"><\/script>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Step 3.<\/span><\/strong> Then,&nbsp;<strong>go&nbsp;<\/strong>to&nbsp;<strong>routes\/web.php<\/strong>&nbsp;file and&nbsp;<strong>define&nbsp;<\/strong>all these routes.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Route::resource(<span class=\"hljs-string\">'country'<\/span>,<span class=\"hljs-string\">'CountryController'<\/span>);\nRoute::any(<span class=\"hljs-string\">'\/search'<\/span>, <span class=\"hljs-string\">'CountryController@search'<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h4 class=\"has-text-align-center wp-block-heading\"><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Run URL<\/span><\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/image-7-1024x576.png\" alt=\"This image has an empty alt attribute; its file name is image-7-1024x576.png\"\/><\/figure>\n\n\n\n<p>Thanks<\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_34636\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_46451\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_34636\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>How to merge two or multiple tables to each other in the Laravel PHP Framework? Part-1 Part-3 Step 1. Go to app\/Country.php. Now, we need to list all the properties we need in the $fillable array. Step 2. Go to app\/Http\/Controllers\/CountryController.php file. Step 3. Then,&nbsp;go&nbsp;to&nbsp;routes\/web.php&nbsp;file and&nbsp;define&nbsp;all these routes. Run URL Thanks<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[1,5201],"tags":[],"class_list":["post-18409","post","type-post","status-publish","format-standard","hentry","category-sql","category-laravel"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=18409"}],"version-history":[{"count":5,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18409\/revisions"}],"predecessor-version":[{"id":24547,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18409\/revisions\/24547"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=18409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=18409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=18409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}