“Компоненты лезвия Laravel” Ответ

Laravel Foreach First

@foreach ($users as $user)
    @if ($loop->first)
        This is the first iteration.
    @endif

    @if ($loop->last)
        This is the last iteration.
    @endif

    <p>This is user {{ $user->id }}</p>
@endforeach
Fernando Gunther

Компоненты лезвия Laravel

// 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"/>
Lazurite

Ответы похожие на “Компоненты лезвия Laravel”

Вопросы похожие на “Компоненты лезвия Laravel”

Больше похожих ответов на “Компоненты лезвия Laravel” по PHP

Смотреть популярные ответы по языку

Смотреть другие языки программирования