livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
327 stars 19 forks source link

[1.x] Adds `uses` interface support #11

Closed nunomaduro closed 1 year ago

nunomaduro commented 1 year ago

This pull request closes https://github.com/livewire/volt/issues/10, and it allows to specify that the given component implements an given interface. Example:

<?php

use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use function Livewire\Volt\uses;

uses([HasTable::class, InteractsWithTable::class]); ?>

$table = fn(Table $table): Table => $table
    ->query(Product::query())
    ->columns([
        TextColumn::make('name'),
    ])
    ->filters([
        // ...
    ]); ?>

<div>
    ...