Okipa / laravel-bootstrap-components

Ready-to-use and customizable form components.
MIT License
20 stars 3 forks source link

Class 'Str' not found #29

Closed fbc closed 5 years ago

fbc commented 5 years ago

I followed the installation instructions. I'm using Laravel 5.8. ErrorException thrown with message "Class 'Str' not found (View: /home/ubuntu/xxx/vendor/okipa/laravel-bootstrap-components/resources/views/bootstrap-components/form/input.blade.php) (View: /home/ubuntu/xxx/vendor/okipa/laravel-bootstrap-components/resources/views/bootstrap-components/form/input.blade.php)"

Stacktrace:

70 ErrorException in /home/ubuntu/xxx/storage/framework/views/69c2f417b07ea0b88a76987f09aee221c94cb94c.php:1

69 Illuminate\View\Engines\CompilerEngine:handleViewException in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:45

68 Illuminate\View\Engines\CompilerEngine:handleViewException in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:47

67 Symfony\Component\Debug\Exception\FatalThrowableError in /home/ubuntu/xxx/storage/framework/views/69c2f417b07ea0b88a76987f09aee221c94cb94c.php:1

66 include in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:43

65 Illuminate\View\Engines\PhpEngine:evaluatePath in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:59

64 Illuminate\View\Engines\CompilerEngine:get in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:142

63 Illuminate\View\View:getContents in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:125

62 Illuminate\View\View:renderContents in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:90

61 Illuminate\View\View:render in /home/ubuntu/xxx/vendor/okipa/laravel-bootstrap-components/src/Component.php:166

60 Okipa\LaravelBootstrapComponents\Component:render in /home/ubuntu/xxx/vendor/okipa/laravel-bootstrap-components/src/Component.php:150

59 Okipa\LaravelBootstrapComponents\Component:toHtml in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Support/helpers.php:610

58 e in /home/ubuntu/xxx/storage/framework/views/7192651836cbb5bc718f599dd77c5d92cbc84c0c.php:31

57 include in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:43

56 Illuminate\View\Engines\PhpEngine:evaluatePath in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:59

55 Illuminate\View\Engines\CompilerEngine:get in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:142

54 Illuminate\View\View:getContents in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:125

53 Illuminate\View\View:renderContents in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/View.php:90

52 Illuminate\View\View:render in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Http/Response.php:42

51 Illuminate\Http\Response:setContent in /home/ubuntu/xxx/vendor/symfony/http-foundation/Response.php:202

50 Symfony\Component\HttpFoundation\Response:__construct in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:748

49 Illuminate\Routing\Router:toResponse in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:720

48 Illuminate\Routing\Router:prepareResponse in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:680

47 Illuminate\Routing\Router:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30

46 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41

45 Illuminate\Routing\Middleware\SubstituteBindings:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

43 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:75

42 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

40 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49

39 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

37 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:56

36 Illuminate\Session\Middleware\StartSession:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

34 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37

33 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

31 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66

30 Illuminate\Cookie\Middleware\EncryptCookies:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

29 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

28 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104

27 Illuminate\Pipeline\Pipeline:then in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:682

26 Illuminate\Routing\Router:runRouteWithinStack in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:657

25 Illuminate\Routing\Router:runRoute in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:623

24 Illuminate\Routing\Router:dispatchToRoute in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php:612

23 Illuminate\Routing\Router:dispatch in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176

22 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30

21 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php:65

20 Barryvdh\Debugbar\Middleware\InjectDebugbar:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

19 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

18 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/fideloper/proxy/src/TrustProxies.php:57

17 Fideloper\Proxy\TrustProxies:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

15 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21

14 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

12 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21

11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

9 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27

8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

6 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62

5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

3 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104

2 Illuminate\Pipeline\Pipeline:then in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151

1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /home/ubuntu/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116

0 Illuminate\Foundation\Http\Kernel:handle in /home/ubuntu/xxx/public/index.php:55

Okipa commented 5 years ago

Hi @fbc, it seems that Laravel doesn't load the Str Facade in your views.
Laravel 5.8 should be supporting this by default.
Could you check you have this line in your /config/app.php file ? https://github.com/laravel/laravel/blob/master/config/app.php#L224

fbc commented 5 years ago

Looks like it works now, thanks!

How would I recreate something like this: <input id="password" placeholder="Desired Password:" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required> would use ->componentClasses?

Okipa commented 5 years ago

No, you should use ->componentHtmlAttributes(['required']) in this case.