Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel blade components

// Create component in terminal using :
	php artisan make:component MyComponent
  
// 2 files will be made : 
// * appViewComponentsMyComponent.php 
//   - Handels functionality.
// * resourcesviewscomponentsmy-component.blade.php ()
//   - Code snippet for component. Must be inside <div>...</div>.
  	
// Call component in any other blade file using :
	<x-my-component />

// Send hardcoded parameter :
    <x-my-component name="Hello World!"/>

// Send a php parameter :
    <x-my-component :text="$message"/>
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #laravel #blade #components
ADD COMMENT
Topic
Name
1+8 =