🎣

Component

we can use this piece of code again and again in the code .
php artisan make:component Header
This will create a Header component
notion image
This will generate two files one is under resources→views→components→Header.blade.php[For frontend code]
and the second one is created under the app→views→components→Header.php [For some dynamic code ]
 

Use

To use the component you can use <x-component_name /> in any of the view page to access the component
 
 

Pass data for dynamic rendering of the components

You can use the component in the view such that <x-component_name var1=”var1” />
Then you have to go to the dynamic part of the component and there you have to define a property and set it to the getting varible as shown below
notion image