0

I'm getting a "blade not found shop.cart.favorites" error when running in Docker on Ubuntu. (Therefore: "case-sensitive file system.")

I suspect that the culprit is case-sensitivity. The path to the blade file is:

 resources/views/Shop/Cart/favorites.blade.php
                 ^    ^

Did I guess correctly?

Mike Robinson
  • 8,490
  • 5
  • 28
  • 41

3 Answers3

0

You have made a little mistake bro...

Change in your Controller/Function where you defined the View .Like this.....

return View('Shop.Cart.favorites'); 

It will work.. Check it out..

Thank you.

0

In the process of rendering a View, the view() method in Laravel checks to see if a Blade template file exists at the path provided using the PHP built-in method file_exists().

Although the docs don't mention it at all, it has long been observed that this function can be case sensitive (typically on *nix-based filesystems, though not on Windows). But since you don't necessarily know where your code will be run (e.g. if you are creating a package), best practice for cross-platform compatibility is to use only lowercase filenames for Blade template files.

Erich
  • 2,408
  • 18
  • 40
  • 2
    I'd just note that it's only case sensitive *if* the filesystem is. We see quite a few questions here where it works on Windows locally, but not when deployed on Linux. – ceejayoz Feb 19 '20 at 02:19
0

Okay, thanks folks. Indeed, that's the [ANSWER] I was expecting: the underlying filesystem is case-sensitive, and therefore so is PHP (file_exists() et al ...), and therefore so is Laravel. Blade file and folder names are case-sensitive.


Now ... here's a follow-on question: is there a handy-dandy plugin for Laravel that might enable me to "skate around" this issue? (Yeah, I think I know what that answer will be, too. But it doesn't hurt to ask ...)

Mike Robinson
  • 8,490
  • 5
  • 28
  • 41