{"id":17613,"date":"2023-04-14T12:51:43","date_gmt":"2023-04-14T07:21:43","guid":{"rendered":"https:\/\/www.milesweb.in\/hosting-faqs\/?p=17613"},"modified":"2024-06-14T12:30:52","modified_gmt":"2024-06-14T07:00:52","slug":"how-to-clear-cache-in-laravel","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/","title":{"rendered":"How to Clear Cache in Laravel? Know Here"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.milesweb.in\/blog\/technology-hub\/why-laravel-is-the-best-php-framework\/\">Laravel is an open-source PHP framework<\/a> used for building web applications, and it works on the MVC model-view-controller framework.&nbsp;<\/p>\n\n\n\n<p>While building Laravel applications, sometimes,&nbsp; the changes in the code are not reflected. This issue usually occurs due to caching. In this tutorial, we will learn about how to clear caches in Laravel applications.&nbsp;<\/p>\n\n\n\n<p>There are two ways to clear the caches in Laravel, one through the artisan command and the other from browsers.<\/p>\n\n\n\n<p>In this article, we will understand the steps you can use to clear different types of caches like the config caches, view caches, route caches, and application caches from your Laravel application.&nbsp;<\/p>\n\n\n\n<h4 style=\"background-color: #D5EAFF; padding: 10px;\">Pick A <a href=\"https:\/\/www.milesweb.in\/hosting\/laravel-hosting\" target=\"_blank\" rel=\"noopener\">Laravel Hosting<\/a> Plans To Scale Laravel Applications!<\/h4>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Clear Cache in Laravel Using Artisan Commands:<\/h2>\n\n\n\n<p>The first step is to open your terminal and go to the Laravel application&#8217;s folder and execute the command:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Clear Application Cache<\/h3>\n\n\n\n<p>For running the laravel application cache, run the following artisan command:<\/p>\n\n\n\n<p><strong><em>php artisan cache:clear<\/em><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Clear Route Cache<\/h3>\n\n\n\n<p>To clear the route cache of your Laravel application, run the below artisan command:<\/p>\n\n\n\n<p><strong><em>php artisan route:clear<\/em><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Clear Configuration Cache<\/h3>\n\n\n\n<p>If you want to clear the config cache of your Laravel application, run the command:<\/p>\n\n\n\n<p><strong><em>php artisan config:clear<\/em><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Clear Compiled Views Cache&nbsp;<\/h3>\n\n\n\n<p>If you need to clear and view cache of your laravel application, simply run the artisan command given below:&nbsp;<\/p>\n\n\n\n<p><strong><em>php artisan view:clear<\/em><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Clearing Cache in Laravel Through Web Browser<\/h2>\n\n\n\n<p>Now, to clear the cache through the browser, then we need to run these commands programmatically, as it&#8217;s difficult to get console access to your Laravel application. So, this method is easy and helpful.&nbsp;<\/p>\n\n\n\n<p>First, we need to create specific routes in Laravel, as shown below:\u00a0<\/p>\n\n\n\n<div class=\"vlt-box \">\n<div class=\"box-content\" >\n<p><b>\/\/ Clear application cache:<\/b><br>\n\nRoute::get(&#8216;\/clear-cache&#8217;, function() {<br>\n\u00a0\u00a0\u00a0\u00a0Artisan::call(&#8216;cache:clear&#8217;);<br>\n});<br>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br>\n<b>\/\/Clear route cache:<\/b><br>\n\nRoute::get(&#8216;\/route-cache&#8217;, function() {<br>\nArtisan::call(&#8216;route:cache&#8217;);<br>\n\u00a0\u00a0\u00a0\u00a0return &#8216;Routes cache has been cleared;<br>\n});<br>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br>\n<b>\/\/Clear config cache:<\/b><br>\n\nRoute::get(&#8216;\/config-cache&#8217;, function() {<br>\n\u00a0 Artisan::call(&#8216;config:cache&#8217;);<br>\n return &#8216;Config cache has been cleared;<br>\n});\u00a0<br>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br>\n<b>\/\/ Clear view cache:<\/b><br>\n\nRoute::get(&#8216;\/view-clear&#8217;, function() {<br>\n\u00a0\u00a0\u00a0\u00a0Artisan::call(&#8216;view:clear&#8217;);<br>\n    return &#8216;View cache has been cleared;<br>\n});<br><\/p>\n<\/div><\/div>\n\n\n\n<p>This is how you can clear caches in Laravel using the Artisan command.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Laravel is an open-source PHP framework used for building web applications, and it works on the MVC model-view-controller framework.&nbsp; While building Laravel applications, sometimes,&nbsp; the changes in the code are not reflected. This issue usually occurs due to caching. In this tutorial, we will learn about how to clear caches in Laravel applications.&nbsp; There are [&hellip;]<\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[2997,2992],"class_list":["post-17613","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-clear-cache-in-laravel","tag-laravel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Clear Cache in Laravel? Know Here | MilesWeb<\/title>\n<meta name=\"description\" content=\"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.\" \/>\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.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Clear Cache in Laravel? Know Here | MilesWeb\" \/>\n<meta property=\"og:description\" content=\"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-14T07:21:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-14T07:00:52+00:00\" \/>\n<meta name=\"author\" content=\"Nehal Khatri\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nehal Khatri\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\"},\"author\":{\"name\":\"Nehal Khatri\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\"},\"headline\":\"How to Clear Cache in Laravel? Know Here\",\"datePublished\":\"2023-04-14T07:21:43+00:00\",\"dateModified\":\"2024-06-14T07:00:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\"},\"wordCount\":379,\"commentCount\":0,\"keywords\":[\"Clear Cache in Laravel\",\"Laravel\"],\"articleSection\":[\"How-Tos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\",\"name\":\"How to Clear Cache in Laravel? Know Here | MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"datePublished\":\"2023-04-14T07:21:43+00:00\",\"dateModified\":\"2024-06-14T07:00:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\"},\"description\":\"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Clear Cache in Laravel? Know Here\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb\",\"name\":\"Nehal Khatri\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png\",\"caption\":\"Nehal Khatri\"},\"description\":\"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/nehal-khatri\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Clear Cache in Laravel? Know Here | MilesWeb","description":"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.","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.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/","og_locale":"en_US","og_type":"article","og_title":"How to Clear Cache in Laravel? Know Here | MilesWeb","og_description":"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2023-04-14T07:21:43+00:00","article_modified_time":"2024-06-14T07:00:52+00:00","author":"Nehal Khatri","twitter_misc":{"Written by":"Nehal Khatri","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/"},"author":{"name":"Nehal Khatri","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb"},"headline":"How to Clear Cache in Laravel? Know Here","datePublished":"2023-04-14T07:21:43+00:00","dateModified":"2024-06-14T07:00:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/"},"wordCount":379,"commentCount":0,"keywords":["Clear Cache in Laravel","Laravel"],"articleSection":["How-Tos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/","name":"How to Clear Cache in Laravel? Know Here | MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"datePublished":"2023-04-14T07:21:43+00:00","dateModified":"2024-06-14T07:00:52+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb"},"description":"It\u2019s easy to clear cache in Laravel, one is through the artisan command and other through the browser. Here\u2019s a article that explains the steps to clear cache in Laravel.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-clear-cache-in-laravel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to Clear Cache in Laravel? Know Here"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/93565765cf85bc4be78b4d9ccbe294bb","name":"Nehal Khatri","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2022\/02\/nehal-khatri-150x150.png","caption":"Nehal Khatri"},"description":"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.","url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/nehal-khatri\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=17613"}],"version-history":[{"count":3,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17613\/revisions"}],"predecessor-version":[{"id":18108,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/17613\/revisions\/18108"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=17613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=17613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=17613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}