laravel 7 blade component public methods not working #33454
              
                Unanswered
              
          
                  
                    
                      mohammadmojrian
                    
                  
                
                  asked this question in
                General
              
            Replies: 2 comments 4 replies
-
| 
         Your testc class name is wrong. It needs to start with an uppercase letter as the PSR-4 autoloading standard requires: <?php
namespace App\View\Components;
use Illuminate\View\Component;
class Testc extends Component | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            -
| 
         I tried out your code and everything works fine for me:  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    3 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I have a problem with my Laravel project in using blade component.
When I define a new component and want to use "Component public Methods" to pass data to "view component blade file", I receive an error, "Undefined variable"
The component has been made by
php artisan make:component testchas following codes:
component code
view component blade file
Error
i try
cache:clearview:clearandcomposer dumpbeforelaravel version : 7.18.0
php version : 7.2.24
Beta Was this translation helpful? Give feedback.
All reactions