有什么想法吗,伙计们?
编辑:
控制器:
public function index() {
$tableQuery = User::query();
return view('table', compact('tableQuery'));
}
桌子刀身php:
<livewire:table
:tableQuery=$tableQuery
>
App\Http\Livewire\Table:
class Table extends Component{
private $tableQuery;
public function mount($tableQuery){
$this->tableQuery = $tableQuery;
}
public function render(){
return view('livewire.table');
}
}
你可以在livewire
中使用Model
class Table extends Component{
public $tableQuery;
public function mount(){
$this->tableQuery = User::query();;
}
public function render(){
return view('livewire.table');
}
}