Answers for "laravel blade component"

PHP
5

blade if

@if (count($records) === 1)
    I have one record!
@elseif (count($records) > 1)
    I have multiple records!
@else
    I don't have any records!
@endif
Posted by: Guest on December-19-2020
0

laravel blade components

// Create component in terminal using :
	php artisan make:component MyComponent
  
// 2 files will be made : 
// * app\View\Components\MyComponent.php 
//   - Handels functionality.
// * resources\views\components\my-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"/>
Posted by: Guest on September-29-2021

Code answers related to "laravel blade component"

Browse Popular Code Answers by Language