Calden
Calden
FFilament
Created by Calden on 6/15/2024 in #❓┊help
override EditRecord getCancelFormAction()
Hey ! I'd like to add an icon, maybe edit the label text, change the color ... of the "Cancel" button in the EditRecord pages, is there a way to do it globally and not in each EditRecord pages ?
2 replies
FFilament
Created by Calden on 4/2/2024 in #❓┊help
Column relationships problem
Hey ! In a relation manager resource, i have this code :
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('enseignants')
->badge(),
])
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('enseignants')
->badge(),
])
with just "Tables\Columns\TextColumn::make('enseignants')", i have my badges filled with json, like "{"id":15,"civilite_id":2,"prenom":"Audrey","nom" ...." . Usually i have to add the field, like "Tables\Columns\TextColumn::make('enseignants.prenom')" to display only "prenom" in the badge. but when i add it, i have a "Call to a member function enseignants() on null" error. The models is :
class MatiereSession extends Pivot
{
use HasFactory;

protected $table = 'matiere_session';

public function matiere(): BelongsTo
{
return $this->belongsTo(Matiere::class);
}

public function session(): BelongsTo
{
return $this->belongsTo(Session::class);
}

public function enseignants()
{
return $this->matiere->enseignants()->wherePivot('session_id', $this->session->id);

}
class MatiereSession extends Pivot
{
use HasFactory;

protected $table = 'matiere_session';

public function matiere(): BelongsTo
{
return $this->belongsTo(Matiere::class);
}

public function session(): BelongsTo
{
return $this->belongsTo(Session::class);
}

public function enseignants()
{
return $this->matiere->enseignants()->wherePivot('session_id', $this->session->id);

}
` I dont know what to do to make it work :/
9 replies
FFilament
Created by Calden on 3/27/2024 in #❓┊help
repeater and disabledOn
Hey ! Cant find a way to make it work ... i have a repeater with for exemple 2 records in the database ... i'd like my field to be disabled on edit for the records already in the database BUT, if i add a new row on my repeater i'd like to be able to edit the new row field. Any ideas ? 🙂
2 replies
FFilament
Created by Calden on 2/6/2024 in #❓┊help
Concat two form fields with multiple select relationship
Hey ! In a resource file, i have this
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('teams')
->multiple()
->relationship('teams', 'name')
->preload()
->required(),
Forms\Components\TextInput::make('group')
->maxLength(255),
Forms\Components\TextInput::make('name'),
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('teams')
->multiple()
->relationship('teams', 'name')
->preload()
->required(),
Forms\Components\TextInput::make('group')
->maxLength(255),
Forms\Components\TextInput::make('name'),
in the name field, i'd like to concat all selected names of team selected in the multiselect teams field and concat this with the group textinput field I dont understand how to get teams names with afterStateUpdated, i only get ids of teams. Any help ? 🙂
2 replies
FFilament
Created by Calden on 2/1/2024 in #❓┊help
Installation of Document-Templates with filament.
Hey ! I'm trying to use the laravel Document-Templates plugin (https://github.com/42coders/document-templates) but i'm a newbie "dev" and i dont understand how to first "use it" and 2nd how to implement it in my filament admin panel. I have done all the installation part, except the route. Filament plugins installations are easy, but i have trouble with this one. Any help ?
2 replies