GeRaged | Niklas
GeRaged | Niklas
FFilament
Created by GeRaged | Niklas on 11/17/2023 in #❓┊help
Spatie Roles Permissions
I tried this and added an debug message to it, but on visit, there is no debug message.
public static function canView(Model $record): bool
{
return auth()->user()->hasRole('Admin');
}
public static function canView(Model $record): bool
{
return auth()->user()->hasRole('Admin');
}
7 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
I made a custom filament/livewire component
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Remove Repeater when empty
Okay thanks 👍
5 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
<?php

namespace App\Filament\Resources\AtollResource\Pages;

use App\Filament\Resources\AtollResource;
use App\Filament\Resources\IslandResource;
use App\Models\Atoll;
use App\Models\Island;
use Filament\Forms\Components\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;

class EditAtoll extends EditRecord
{
protected static string $resource = AtollResource::class;

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),

Section::make()
->schema(fn (Atoll $record) => $record->islands()->get()->map(fn (Island $island) => Action::make($island->id)
->url(IslandResource::getUrl('edit', ['record' => $island->id])))->toArray())
]);
}

protected function getActions(): array
{
return [
DeleteAction::make(),
];
}
}
<?php

namespace App\Filament\Resources\AtollResource\Pages;

use App\Filament\Resources\AtollResource;
use App\Filament\Resources\IslandResource;
use App\Models\Atoll;
use App\Models\Island;
use Filament\Forms\Components\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;

class EditAtoll extends EditRecord
{
protected static string $resource = AtollResource::class;

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),

Section::make()
->schema(fn (Atoll $record) => $record->islands()->get()->map(fn (Island $island) => Action::make($island->id)
->url(IslandResource::getUrl('edit', ['record' => $island->id])))->toArray())
]);
}

protected function getActions(): array
{
return [
DeleteAction::make(),
];
}
}
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
I did
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
Now I get this error Argument #1 ($component) must be of type Filament\Forms\Components\Component, Filament\Forms\Components\Actions\Action given
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
I want to list the relations in an edit form in a placeholder with action url
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
How can I use an Action inside a form?
15 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
Where can I set the id for the edit?
15 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Unable to call component method. Public method [setValue] not found on component
Can you give me an example how I can render a livewire component inside a Field Component?
22 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Unable to call component method. Public method [setValue] not found on component
But I am struggeling to bind the select where I can select the groups and the saving it to a variable in the component an then filter the checkboxes by the group of the select
22 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Unable to call component method. Public method [setValue] not found on component
I am currently try to build a filterable checkbox list where I can filter by the checkbox group
22 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Unable to call component method. Public method [setValue] not found on component
And how can I make my Field Component be a livewire component?
22 replies
FFilament
Created by GeRaged | Niklas on 9/15/2023 in #❓┊help
Update Checkboxes when select something
// In getComponents() method
$attributes = Attribute::whereAllowsModel(Resort::class)->get();
$data = $attributes->groupBy('group')->where('group', //HERE I WANT THE OUTPUT OF THE SELECT)->map(function ($item) {
return $item->pluck('name', 'id')->toArray();
});

// Inside the form schema of the getComponents() method

Section::make('Group')
->schema([
Select::make('query')
->label('Group')
->options(Attribute::whereAllowsModel(Resort::class)->select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
->afterStateUpdated(function ($state, callable $get, callable $set) {
// HERE I WANT TO UPDATE THE CHECKBOXES BELOW FILTERED BY THE HERE SELECTED GROUP
})
]),
Section::make('Attribute')
->schema(
$data->map(fn ($attributes, $group) =>
CheckboxList::make($group)
->options($attributes)
->visible())->toArray()
)
->columns(3)
// In getComponents() method
$attributes = Attribute::whereAllowsModel(Resort::class)->get();
$data = $attributes->groupBy('group')->where('group', //HERE I WANT THE OUTPUT OF THE SELECT)->map(function ($item) {
return $item->pluck('name', 'id')->toArray();
});

// Inside the form schema of the getComponents() method

Section::make('Group')
->schema([
Select::make('query')
->label('Group')
->options(Attribute::whereAllowsModel(Resort::class)->select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
->afterStateUpdated(function ($state, callable $get, callable $set) {
// HERE I WANT TO UPDATE THE CHECKBOXES BELOW FILTERED BY THE HERE SELECTED GROUP
})
]),
Section::make('Attribute')
->schema(
$data->map(fn ($attributes, $group) =>
CheckboxList::make($group)
->options($attributes)
->visible())->toArray()
)
->columns(3)
2 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Save value from TextInput for sarch
...
11 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Save value from TextInput for sarch
I want multiple checkboxes but only with attributes where I selected the group from
11 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Save value from TextInput for sarch
<?php

namespace App\Filament\Resources\OperatorResource\Pages;

use App\Filament\Resources\OperatorResource;
use App\Models\Attribute;
use App\Models\Resort;
use Filament\Actions;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;

class EditOperator extends EditRecord
{
protected static string $resource = OperatorResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}

public function form(Form $form): Form
{

$attributes = Attribute::whereAllowsModel(Resort::class)->get();
$data = $attributes->groupBy('group')->map(function ($item) {
return $item->pluck('name', 'id')->toArray();
});

return $form
->schema([
Section::make('Suche')
->schema([
Select::make('query')
->label('Gruppe')
->options(Attribute::whereAllowsModel(Resort::class)->select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
]),
Section::make('Attribute')
->schema(
$data->map(function ($attributes, $group) {
return CheckboxList::make($group)
->options($attributes)
->visible();
}
)->toArray()
)
->columns(3)
]);
}

}
<?php

namespace App\Filament\Resources\OperatorResource\Pages;

use App\Filament\Resources\OperatorResource;
use App\Models\Attribute;
use App\Models\Resort;
use Filament\Actions;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;

class EditOperator extends EditRecord
{
protected static string $resource = OperatorResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}

public function form(Form $form): Form
{

$attributes = Attribute::whereAllowsModel(Resort::class)->get();
$data = $attributes->groupBy('group')->map(function ($item) {
return $item->pluck('name', 'id')->toArray();
});

return $form
->schema([
Section::make('Suche')
->schema([
Select::make('query')
->label('Gruppe')
->options(Attribute::whereAllowsModel(Resort::class)->select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
]),
Section::make('Attribute')
->schema(
$data->map(function ($attributes, $group) {
return CheckboxList::make($group)
->options($attributes)
->visible();
}
)->toArray()
)
->columns(3)
]);
}

}
11 replies
FFilament
Created by GeRaged | Niklas on 9/14/2023 in #❓┊help
How to make own form component
Yes but I find it not well documented how to work with Livewire etc.. There is a lot left out and not everything is explained properly, as it should be for a documentation.
5 replies
FFilament
Created by GeRaged | Niklas on 9/13/2023 in #❓┊help
Installing filepond plugin for file upload
In which file?
6 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Save value from TextInput for sarch
This is the error Using $this when not in object context
11 replies