{"id":5456,"date":"2021-03-11T08:46:30","date_gmt":"2021-03-11T08:46:30","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5456"},"modified":"2021-03-11T08:46:30","modified_gmt":"2021-03-11T08:46:30","slug":"how-control-flow-in-laravel","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/","title":{"rendered":"How Control flow in Laravel"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;task&#8217;);<\/em>                                        Explanation:-                                                                                                                              name(&#8216;<strong>task<\/strong>&#8216;) is given in the URL as <strong>http:\/\/127.0.0.1:8000\/task<\/strong>.                                         <span class=\"has-inline-color has-vivid-red-color\"><strong>Control flow<\/strong><\/span>:-                                                                                                                                                                                                                  As the URL is hit the control will go the route(<strong><em>web.php<\/em><\/strong>), there it will get <em>Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;task&#8217;);<\/em>                                                       Here, there will be a name match from the URL and if there is match then there will be a function call named <strong>index<\/strong> and route will redirect to <em><strong>TaskController.php<\/strong><\/em> where it will find the function <em>index <\/em>and operate according to the instructions given inside it.                                                                       <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the create operation we need to store the data in the database for this we used <strong><em>&lt;form&nbsp;action=&#8221;{{route(&#8216;store&#8217;)}}&#8221;&nbsp;method=&#8221;POST&#8221;&gt;<\/em><\/strong> which will call store function.                                                                                                                                  The store function be like                                                                                                        <\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/abhi040498\/c57065a3124ffb12ff36e63334907604.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">The in store function we create object <strong>$var<\/strong> of <strong>Task <\/strong>class make variables as <strong>$var-&gt;task<\/strong>&nbsp;which is assigned&nbsp;<strong>$request-&gt;task;<\/strong>&nbsp;(gets value from 1<sup>st<\/sup> field) &amp; <strong>$var-&gt;detail <\/strong>which is assigned&nbsp;<strong>$request-&gt;detail;<\/strong>&nbsp;(gets value from 2<sup>nd<\/sup> field) and <strong><em>$var-&gt;save(); <\/em><\/strong>function will save it to the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">                               <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;task&#8217;); Explanation:- name(&#8216;task&#8216;) is given in the URL as http:\/\/127.0.0.1:8000\/task. Control flow:- As the URL is hit the control will [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5049,156],"tags":[5099,5097,5098,5063],"class_list":["post-5456","post","type-post","status-publish","format-standard","hentry","category-laravel","category-websites","tag-control-flow-explanation","tag-control-flow-in-laravel","tag-laravel-control-flow","tag-laravel-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Control flow in Laravel - 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\/how-control-flow-in-laravel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Control flow in Laravel - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;task&#8217;); Explanation:- name(&#8216;task&#8216;) is given in the URL as http:\/\/127.0.0.1:8000\/task. Control flow:- As the URL is hit the control will [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-11T08:46:30+00:00\" \/>\n<meta name=\"author\" content=\"abhishek k\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"abhishek k\" \/>\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\\\/how-control-flow-in-laravel\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/\"},\"author\":{\"name\":\"abhishek k\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/143500a93b88a96d3c9602b3df804cb6\"},\"headline\":\"How Control flow in Laravel\",\"datePublished\":\"2021-03-11T08:46:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/\"},\"wordCount\":198,\"commentCount\":0,\"keywords\":[\"control flow explanation\",\"control flow in laravel\",\"laravel control flow\",\"laravel project\"],\"articleSection\":[\"Laravel\",\"Websites\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/\",\"name\":\"How Control flow in Laravel - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-03-11T08:46:30+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/143500a93b88a96d3c9602b3df804cb6\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-control-flow-in-laravel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Control flow in Laravel\"}]},{\"@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\\\/143500a93b88a96d3c9602b3df804cb6\",\"name\":\"abhishek k\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"caption\":\"abhishek k\"},\"description\":\"Abhishek is a full-stack developer that provides the solution for the design and analysis of Website and Mobile Application. Expertise in HTML, CSS, JAVASCRIPT, LARAVEL.\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/abhishek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Control flow in Laravel - 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\/how-control-flow-in-laravel\/","og_locale":"en_US","og_type":"article","og_title":"How Control flow in Laravel - scmGalaxy","og_description":"Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;task&#8217;); Explanation:- name(&#8216;task&#8216;) is given in the URL as http:\/\/127.0.0.1:8000\/task. Control flow:- As the URL is hit the control will [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-11T08:46:30+00:00","author":"abhishek k","twitter_card":"summary_large_image","twitter_misc":{"Written by":"abhishek k","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/"},"author":{"name":"abhishek k","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/143500a93b88a96d3c9602b3df804cb6"},"headline":"How Control flow in Laravel","datePublished":"2021-03-11T08:46:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/"},"wordCount":198,"commentCount":0,"keywords":["control flow explanation","control flow in laravel","laravel control flow","laravel project"],"articleSection":["Laravel","Websites"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/","name":"How Control flow in Laravel - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-03-11T08:46:30+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/143500a93b88a96d3c9602b3df804cb6"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-control-flow-in-laravel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How Control flow in Laravel"}]},{"@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\/143500a93b88a96d3c9602b3df804cb6","name":"abhishek k","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","caption":"abhishek k"},"description":"Abhishek is a full-stack developer that provides the solution for the design and analysis of Website and Mobile Application. Expertise in HTML, CSS, JAVASCRIPT, LARAVEL.","url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/abhishek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5456","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\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5456"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5456\/revisions"}],"predecessor-version":[{"id":5491,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5456\/revisions\/5491"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}