spyworld
1 week ago
131
4
Laravel

how to create component by separating section content (L8)

Posted 1 week ago by spyworld

To create a blade component, we will create a component class to pass the content. I'm trying to separate content in inside the element.

blade component like:

<div class="{{ $type }}">
	//slot
    	<body>
		{{ $body }}
	</body>
	<footer>
		//slot
		{{ $footer }}
	</footer>
</div>

Usage like: Example:

<x-element type="warning-alter">
	@body()
		this is body
	@endbody
	@footer
		this is footer
	@endfooter
</x-element>

Not going to use attribute for body & footer.

Please sign in or create an account to participate in this conversation.