{"id":5509,"date":"2021-03-12T11:47:11","date_gmt":"2021-03-12T11:47:11","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5509"},"modified":"2021-03-12T12:21:14","modified_gmt":"2021-03-12T12:21:14","slug":"database-query-builder","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/","title":{"rendered":"Database: Query Builder"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this we will learn how to use database query in the controller. First of all we need to import database class by mentioning:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use DB;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By importing DB class we can execute data through controller. Now we need to make a function in the controller and insert the values.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/7a670d2dbd5cfeb50c13e22472d590fe.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">Then in the blade view we need to call the values:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/87a6eae0a0e8dfd9e2f988563281bad7.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">Now we can serve the local server php artisan serve and we can see the details provided in the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can see the demonstration in the video given below:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\"  id=\"_ytid_92593\"  width=\"640\" height=\"360\"  data-origwidth=\"640\" data-origheight=\"360\" src=\"https:\/\/www.youtube.com\/embed\/5_MMw45yDLQ?enablejsapi=1&#038;list=PLT9miexWCpPXuMenRSnpek96ncK3dXf90&#038;index=15&#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__  epyt-is-override  no-lazyload\" title=\"YouTube player\"  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>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In this we will learn how to use database query in the controller. First of all we need to import [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5049,156],"tags":[],"class_list":["post-5509","post","type-post","status-publish","format-standard","hentry","category-laravel","category-websites"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Database: Query Builder - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Database: Query Builder - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"In this we will learn how to use database query in the controller. First of all we need to import [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-12T11:47:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-12T12:21:14+00:00\" \/>\n<meta name=\"author\" content=\"Joydeep M\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joydeep M\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/\"},\"author\":{\"name\":\"Joydeep M\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\"},\"headline\":\"Database: Query Builder\",\"datePublished\":\"2021-03-12T11:47:11+00:00\",\"dateModified\":\"2021-03-12T12:21:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/\"},\"wordCount\":108,\"commentCount\":0,\"articleSection\":[\"Laravel\",\"Websites\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/\",\"name\":\"Database: Query Builder - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-03-12T11:47:11+00:00\",\"dateModified\":\"2021-03-12T12:21:14+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/database-query-builder\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Database: Query Builder\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\",\"name\":\"Joydeep M\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"caption\":\"Joydeep M\"},\"description\":\"An investment in knowledge pays the best interest.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/joydeep-kumar-538412208\\\/\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/joydeep\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Database: Query Builder - scmGalaxy","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:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/","og_locale":"en_US","og_type":"article","og_title":"Database: Query Builder - scmGalaxy","og_description":"In this we will learn how to use database query in the controller. First of all we need to import [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-12T11:47:11+00:00","article_modified_time":"2021-03-12T12:21:14+00:00","author":"Joydeep M","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joydeep M","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/"},"author":{"name":"Joydeep M","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6"},"headline":"Database: Query Builder","datePublished":"2021-03-12T11:47:11+00:00","dateModified":"2021-03-12T12:21:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/"},"wordCount":108,"commentCount":0,"articleSection":["Laravel","Websites"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/","name":"Database: Query Builder - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-03-12T11:47:11+00:00","dateModified":"2021-03-12T12:21:14+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/database-query-builder\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Database: Query Builder"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6","name":"Joydeep M","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","caption":"Joydeep M"},"description":"An investment in knowledge pays the best interest.","sameAs":["https:\/\/www.linkedin.com\/in\/joydeep-kumar-538412208\/"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/joydeep\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5509"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5509\/revisions"}],"predecessor-version":[{"id":5512,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5509\/revisions\/5512"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}