F
Filament2y ago
Eren

Multiple Dynamic Path for Slug

Hi Guys , I want to bring $city->name on my slug from ID. I dont know how to achieve it. If you can help me.
Thank you. “ Forms\Components\Select::make('city_id') ->relationship('cities', 'name') ->required(), Forms\Components\TextInput::make('name') ->required() ->reactive() ->afterStateUpdated(function ($state, callable $set, callable $get){ $city = $get('city_id'); ** How can i bring $city->name instead of ID here ? ** $slug = Str::slug($state); $set('slug', $cityName . '/' . $slug); }), Forms\Components\TextInput::make('slug') ->disabled() ->required(), “
6 Replies
Dan Harrin
Dan Harrin2y ago
City::find($city)->name ? eloquent?
Eren
ErenOP2y ago
Yes its Eloquent City Model. Oh i got it. I didnt know its working like that 🙂 One last question. City name is coming with Uppercase. Is there any way to make it lowercase ?
GwnMik02
GwnMik022y ago
Str::lower($cityName)?
Eren
ErenOP2y ago
Thank you so much for your help guys. Im sorry if it was silly questions. Im trying to learn filament. I sorted now.
Dan Harrin
Dan Harrin2y ago
theyre laravel and php questions, you should learn those before filament
Eren
ErenOP2y ago
I can do that with laravel but I didnt understand livewire yet. I should learn livewire more. Thank you Dan.

Did you find this page helpful?