wandiaprianto
wandiaprianto
FFilament
Created by wandiaprianto on 12/7/2023 in #❓┊help
Filament Shield, how to create different permissions in same role
Hi There, i am using Filament Shield, my question is: how to create different permissions in same role? example: Role: USER Permission
User: John Resources: Brand Can: Create, Read, Update
User: Doe Resources: Brand Can: Read, Update, Delete
how to achieve that? Thankyou
22 replies
FFilament
Created by wandiaprianto on 11/13/2023 in #❓┊help
How to access resource from resource?
Help me, i want to access resource from resource i want to create "promo" from cars expected url like: http://127.0.0.1:8000/car/{carId}/promos so, when i create new promo, it will be related the car_id this is my code:
Action::make('view_promo')
->url(fn ($record) => PromoResource::getUrl('view', ['record' => $record->id])),
Action::make('view_promo')
->url(fn ($record) => PromoResource::getUrl('view', ['record' => $record->id])),
this is the result:
Route [filament.admin.resources.car.promos.view] not defined.
i have 2 models: "Cars" and "Promo"
class Car extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'cars';

public function promos(): HasMany
{
return $this->hasMany(Promo::class, 'car_id');
}

...
}
class Car extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'cars';

public function promos(): HasMany
{
return $this->hasMany(Promo::class, 'car_id');
}

...
}
class Original extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'photos_car_original';

public function car(): BelongsTo
{
return $this->belongsTo(Car::class, 'car_id');
}
}
class Original extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'photos_car_original';

public function car(): BelongsTo
{
return $this->belongsTo(Car::class, 'car_id');
}
}
can u help me? thanks
7 replies
FFilament
Created by wandiaprianto on 11/11/2023 in #❓┊help
Last letter is not capitalized
help me, why the last letter is not capitalized this is my code:
TextInput::make('police_number')
->required()
->placeholder('KB 1234 ST')
->extraAlpineAttributes(['@input' => '$el.value = $el.value.toUpperCase()']),
TextInput::make('police_number')
->required()
->placeholder('KB 1234 ST')
->extraAlpineAttributes(['@input' => '$el.value = $el.value.toUpperCase()']),
thankyou
7 replies
FFilament
Created by wandiaprianto on 11/11/2023 in #❓┊help
How to searchable and sortable my custom column?
Help me, How to searchable and sortable my custom column? here is my code:
TextColumn::make('description')
->getStateUsing(function ($record) {
return $record->brand->name . ' ' . $record->model->name . ' ' . $record->type->name . ' ' . $record->kind->name . ' (' . $record->series->name . ') ' . number_format(doubleval($record->cylinder->volume / 1000), 1) . ' ' . $record->transmission->name . ' ' . $record->gear->name . ' ' . $record->fuel->name . ' ' . $record->color->name . ' (' . $record->year->name . ') ' . $record->row->name;
})
->wrap(),
TextColumn::make('description')
->getStateUsing(function ($record) {
return $record->brand->name . ' ' . $record->model->name . ' ' . $record->type->name . ' ' . $record->kind->name . ' (' . $record->series->name . ') ' . number_format(doubleval($record->cylinder->volume / 1000), 1) . ' ' . $record->transmission->name . ' ' . $record->gear->name . ' ' . $record->fuel->name . ' ' . $record->color->name . ' (' . $record->year->name . ') ' . $record->row->name;
})
->wrap(),
thanks
8 replies
FFilament
Created by wandiaprianto on 11/11/2023 in #❓┊help
How to set TextColumn isHidden / Disabled but searchable?
Hello there, please help me. How to set TextColumn isHidden / Disabled but searchable? here is my code:
TextColumn::make('brand.name')
->searchable()
->sortable()
->hidden(),
TextColumn::make('brand.name')
->searchable()
->sortable()
->hidden(),
hide, but can't search. where did i missed? thankyou
4 replies
FFilament
Created by wandiaprianto on 11/10/2023 in #❓┊help
How to get filename of image (multiple files)
Hi there, please help me to get filename of image (multiple files) here is my code:
Action::make('upload_official')
->icon('heroicon-m-photo')
->form([
FileUpload::make('image')
->multiple()
->previewable(false)
->directory('car-photos-official-attachments')
->image(),
])
->action(function (array $data, Car $car): void {
foreach ($data as $item) {
CarOfficial::create([
'car_id' => $car->id,
'image' => $item['image']
]);
};
}),
Action::make('upload_official')
->icon('heroicon-m-photo')
->form([
FileUpload::make('image')
->multiple()
->previewable(false)
->directory('car-photos-official-attachments')
->image(),
])
->action(function (array $data, Car $car): void {
foreach ($data as $item) {
CarOfficial::create([
'car_id' => $car->id,
'image' => $item['image']
]);
};
}),
14 replies
FFilament
Created by wandiaprianto on 10/26/2023 in #❓┊help
on edit/delete how to delete file?
No description
22 replies
FFilament
Created by wandiaprianto on 10/26/2023 in #❓┊help
How to remove create & create another button?
No description
13 replies
FFilament
Created by wandiaprianto on 10/26/2023 in #❓┊help
nested grouping menu navbar
No description
6 replies
FFilament
Created by wandiaprianto on 10/25/2023 in #❓┊help
unique multiple columns
No description
24 replies
FFilament
Created by wandiaprianto on 10/24/2023 in #❓┊help
how to add +7 GMT in datetime
No description
6 replies
FFilament
Created by wandiaprianto on 10/24/2023 in #❓┊help
select depend by another select option
No description
30 replies
FFilament
Created by wandiaprianto on 10/23/2023 in #❓┊help
custom query before delete
No description
6 replies