konradkalemba / blade-components-scoped-slots Goto Github PK
View Code? Open in Web Editor NEWScoped slots feature addition to Laravel's Blade templating engine
License: MIT License
Scoped slots feature addition to Laravel's Blade templating engine
License: MIT License
Hi,
i would like to add the support of the html syntax to your package (it seems possible with blade)
the idea would be to use it like that (because i don't think we can override for sure the <x-slot></x-slot>
parser before it occurs)
<x-scoped-slot name='row' context='$item'>
</x-scoped-slot>
to create this
@scopedscope('header', '$item')
@endscopedscope
so my questions :
Thanks for your answers !
Using @foreach in scoped slot or using custom blade x component ends up in Undefined variable: __env error
@scopedslot('tableitem', ($item), ($options))
<td>
<div class="flex items-center">
<x-user.circle
name="{{$item->login}}"
></x-user.circle>
<span class="ml-3">{{ $item->login }}</span>
</div>
</td>
@endscopedslot
I downloaded your package using composer and tried to use it.
<x-ui.table
:options="$options"
>
@scopedslot('item', ($object))
{{ $object }}
@endscopedslot
</x-ui.table>
// ui/table.blade.php
@forelse($options as $object)
<tr>
{{ $item($object) }}
</tr>
@empty
<tr>
nothing
</tr>
@endforelse
Ends up in:
Array callback has to contain indices 0 and 1
I registered your class in app.php
in providers
. Is there any other action I should do before using it?
If you have in your model
public function getFooAttribute() {
return 'foo';
}
and you use it in scoped slot like this:
@scopedslot('tableitem', ($item))
@dump($item->foo); {{-- works --}}
{{ $item->foo }} {{-- does not work --}}
@endscopedslot
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.