bernhard
bernhard
FFilament
Created by jjo63 on 8/16/2024 in #❓┊help
->description() - is it possible to further style?
Dennis Koch already mentioned new HtmlString. As an alternative you can also use your own view where you can use blade components, etc.
->description(fn($record) => view("path.to.your.view", ["record" => $record]))
->description(fn($record) => view("path.to.your.view", ["record" => $record]))
6 replies
FFilament
Created by wazkaz on 8/16/2024 in #❓┊help
Global setting for TextColumn partially working
Are you sure, that its not working? I tried this:
TextColumn::configureUsing(function (TextColumn $textColumn): void {
$textColumn->description("xxx");
});
TextColumn::configureUsing(function (TextColumn $textColumn): void {
$textColumn->description("xxx");
});
And I can see the description "xxx" on all $esources and all RelationManager.
9 replies
FFilament
Created by Kaaiman on 8/16/2024 in #❓┊help
Laravel Octane and Filament
I just wanna mention, that I am using Filament v3.2 and Octane in Laravel 10 without any issues
9 replies
FFilament
Created by bernhard on 8/1/2024 in #❓┊help
Action outside of the panel not showing modals
Thanks!
9 replies
FFilament
Created by bernhard on 8/1/2024 in #❓┊help
Action outside of the panel not showing modals
I am so stupid. That solved this issue. Just one last question: The button isn't styled right. None of these are
->color(Color::Blue)
->color("primary")
->color(Color::Blue)
->color("primary")
9 replies
FFilament
Created by bernhard on 8/1/2024 in #❓┊help
Action outside of the panel not showing modals
🤦‍♂️
9 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
In your example, a city belongs to a district and a district belongs to a country. So Country>District>City
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
In my example, a country has ONE capitalCity of type City and a city has ONE mainDistrict of type District. So Country>City>District
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
Works in the same way:
class Country extends Model
{
public function capitalCity(): HasOne
{
return $this->hasOne(City::class);
}
}

class City extends Model
{
public function country(): BelongsTo
{
return $this->belongsTo(Country::class);
}

public function mainDistrict(): HasOne
{
return $this->hasOne(\App\Models\District::class);
}
}


class District extends Model
{
protected function city(): BelongsTo
{
return $this->belongsTo(\App\Models\City::class);
}
}

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

Section::make("Capital")->schema([
TextInput::make("name")->required(),
TextInput::make("zip")->required(),

Section::make("District")->schema([
TextInput::make("name")->required(),
])->relationship("mainDistrict")
])->relationship("capitalCity")
]);
}
}
class Country extends Model
{
public function capitalCity(): HasOne
{
return $this->hasOne(City::class);
}
}

class City extends Model
{
public function country(): BelongsTo
{
return $this->belongsTo(Country::class);
}

public function mainDistrict(): HasOne
{
return $this->hasOne(\App\Models\District::class);
}
}


class District extends Model
{
protected function city(): BelongsTo
{
return $this->belongsTo(\App\Models\City::class);
}
}

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

Section::make("Capital")->schema([
TextInput::make("name")->required(),
TextInput::make("zip")->required(),

Section::make("District")->schema([
TextInput::make("name")->required(),
])->relationship("mainDistrict")
])->relationship("capitalCity")
]);
}
}
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
so we are talking about $client->entity->address
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
ah. this is nested, nested 😄
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
This works
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
Here is an working example:
class Country extends Model
{

public function capitalCity(): HasOne
{
return $this->hasOne(City::class);
}
}

class City extends Model
{
protected function country(): BelongsTo
{
return $this->belongsTo(Country::class);
}
}


class CountryResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),
Section::make("Capital")->schema([
TextInput::make("name")->required(),
TextInput::make("zip")->required()
])->relationship("capitalCity")
]);
}
}
class Country extends Model
{

public function capitalCity(): HasOne
{
return $this->hasOne(City::class);
}
}

class City extends Model
{
protected function country(): BelongsTo
{
return $this->belongsTo(Country::class);
}
}


class CountryResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),
Section::make("Capital")->schema([
TextInput::make("name")->required(),
TextInput::make("zip")->required()
])->relationship("capitalCity")
]);
}
}
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
But in general it should work without any extra logic!
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
If you need extra logic, you can manipulate how the save process is treated with the saveRelationshipsUsing(callback) method
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Nested relation form
Nested relations work. Just for the records if you think about nested resources read https://filamentphp.com/community/alexandersix-filament-what-to-expect-in-2024#nested-resources as well
19 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Reusable sections
or the new cleaner version:
->url(function (Model $record) {
$no = $record->getBusinessNo();

return $no ? 'https://orsr.sk/hladaj_ico.asp?ICO='. $no : null;
})
->url(function (Model $record) {
$no = $record->getBusinessNo();

return $no ? 'https://orsr.sk/hladaj_ico.asp?ICO='. $no : null;
})
27 replies
FFilament
Created by Trauma Zombie on 3/6/2024 in #❓┊help
Reusable sections
because in your example, you have trippled the 'https://orsr.sk/hladaj_ico.asp?ICO='
27 replies