Shaung Bhone
Shaung Bhone
Explore posts from servers
FFilament
Created by Shaung Bhone on 6/7/2024 in #❓┊help
Pesting form builder with upload file
No description
13 replies
FFilament
Created by Shaung Bhone on 3/23/2024 in #❓┊help
One to many polymorphic relationship
No description
4 replies
FFilament
Created by Shaung Bhone on 3/13/2024 in #❓┊help
Using tab in custom page
How can I use filter tab in livewire component? I saw this converstaion but got an error. https://github.com/filamentphp/filament/discussions/10127
1 replies
FFilament
Created by Shaung Bhone on 3/11/2024 in #❓┊help
Can't save form action
I can't save the value in advanced form action that give me null.
Forms\Components\TextInput::make('remaining_stock')
->disabled()
->suffixAction(
Action::make('addingNewStock')
->label('Add New Stock')
->icon('heroicon-m-plus')
->requiresConfirmation()
->form([
Forms\Components\TextInput::make('adding_stock')
->numeric()
->rules(['integer', 'min:0'])
])
->modalIcon('heroicon-m-plus')
->action(function (
Forms\Set $set, Get $get, array $data
): void {
$set(
'remaining_stock',
$get('remaining_stock') + $data['adding_stock']);
})
)
Forms\Components\TextInput::make('remaining_stock')
->disabled()
->suffixAction(
Action::make('addingNewStock')
->label('Add New Stock')
->icon('heroicon-m-plus')
->requiresConfirmation()
->form([
Forms\Components\TextInput::make('adding_stock')
->numeric()
->rules(['integer', 'min:0'])
])
->modalIcon('heroicon-m-plus')
->action(function (
Forms\Set $set, Get $get, array $data
): void {
$set(
'remaining_stock',
$get('remaining_stock') + $data['adding_stock']);
})
)
30 replies
FFilament
Created by Shaung Bhone on 3/8/2024 in #❓┊help
Table with image
No description
4 replies
FFilament
Created by Shaung Bhone on 3/5/2024 in #❓┊help
Boolean status
How can I change boolean status to Yes or No lable in Table Column?
3 replies
FFilament
Created by Shaung Bhone on 2/28/2024 in #❓┊help
Custome theme for table
No description
4 replies
FFilament
Created by Shaung Bhone on 2/8/2024 in #❓┊help
Creating with pivot attributes
I can't create pivot value when creating sku. Sku.php
public function attributes(): BelongsToMany
{
return $this->belongsToMany(Attribute::class, 'attribute_sku')->withPivot('value');
}
public function attributes(): BelongsToMany
{
return $this->belongsToMany(Attribute::class, 'attribute_sku')->withPivot('value');
}
Attribute.php
public function skus(): BelongsToMany
{
return $this->belongsToMany(Sku::class, 'attribute_sku')->withPivot('value');
}
public function skus(): BelongsToMany
{
return $this->belongsToMany(Sku::class, 'attribute_sku')->withPivot('value');
}
SkusRelationManager.php
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('sku')
->required()
->maxLength(255),
Forms\Components\Select::make('attribute_sku')
->relationship('attributes', 'name'),
Forms\Components\TextInput::make('value'),
]);
}
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('sku')
->required()
->maxLength(255),
Forms\Components\Select::make('attribute_sku')
->relationship('attributes', 'name'),
Forms\Components\TextInput::make('value'),
]);
}
2 replies
FFilament
Created by Shaung Bhone on 2/7/2024 in #❓┊help
Filament shield
When I install filament shield php artisan shield:install . I want to get multiple role editor and writer. How can I?
5 replies
FFilament
Created by Shaung Bhone on 11/30/2023 in #❓┊help
Filament noti in livewire component
I'm trying to send a filament notification in a Livewire component when a user creates a post, redirects to the home page, and displays the notification on the home page. How can I? Can I dispatch event or sth?
16 replies
FFilament
Created by Shaung Bhone on 11/28/2023 in #❓┊help
Filament Spatie FileUpload with s3
No description
15 replies
FFilament
Created by Shaung Bhone on 11/28/2023 in #❓┊help
Filter and Search
Can I use filament filter and search in front end?
1 replies
FFilament
Created by Shaung Bhone on 11/25/2023 in #❓┊help
Livewire component event
In the Laravel Livewire boot camp, when creating chirps, the author dispatches an event! In my code, should I need to dispatch an event?
public function create(): void
{
abort_if(auth()->guest(), Response::HTTP_FORBIDDEN);

$resume = Auth::user()
->resume()
->create($this->form->getState());

$this->form->model($resume)->saveRelationships();

$this->redirect('/resume');
}
public function create(): void
{
abort_if(auth()->guest(), Response::HTTP_FORBIDDEN);

$resume = Auth::user()
->resume()
->create($this->form->getState());

$this->form->model($resume)->saveRelationships();

$this->redirect('/resume');
}
2 replies
FFilament
Created by Shaung Bhone on 11/24/2023 in #❓┊help
Laravel Enum with Filament
How can I render enum in laravel blade? When I add laravel casting like this
protected $casts = [
'type' => EmploymentType::class,
];
protected $casts = [
'type' => EmploymentType::class,
];
I can't render in blade file.
<span
class="my-auto ml-3 rounded bg-pink-100 px-2.5 py-0.5 text-sm font-medium text-pink-800 dark:bg-pink-900 dark:text-pink-300">
{{ __(EmploymentType::tryFrom($post->type)->name) }}
</span>
<span
class="my-auto ml-3 rounded bg-pink-100 px-2.5 py-0.5 text-sm font-medium text-pink-800 dark:bg-pink-900 dark:text-pink-300">
{{ __(EmploymentType::tryFrom($post->type)->name) }}
</span>
App\Enums\EmploymentType::tryFrom(): Argument #1 ($value) must be of type string|int, App\Enums\EmploymentType given
App\Enums\EmploymentType::tryFrom(): Argument #1 ($value) must be of type string|int, App\Enums\EmploymentType given
8 replies
FFilament
Created by Shaung Bhone on 10/26/2023 in #❓┊help
Method Filament\Tables\Actions\Action::deactivateAction does not exist.
Where am I do wrong?
Tables\Actions\Action::make('deactivate')
->form([
Forms\Components\Textarea::make('remark')
->string()
->required(),
Forms\Components\TextInput::make('password')
->password()
->required()
->unique(User::class, 'password'),
])
->deactivateAction()
//

public function deactivateAction()
{
$this->action(function (User $record): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $record->remark,
]);
});

return $this;
}
Tables\Actions\Action::make('deactivate')
->form([
Forms\Components\Textarea::make('remark')
->string()
->required(),
Forms\Components\TextInput::make('password')
->password()
->required()
->unique(User::class, 'password'),
])
->deactivateAction()
//

public function deactivateAction()
{
$this->action(function (User $record): void {
$record->deactivateLog()->updateOrCreate([
'remark' => $record->remark,
]);
});

return $this;
}
7 replies
FFilament
Created by Shaung Bhone on 10/24/2023 in #❓┊help
Toggleable and Filter Tab
I am trying to make the relation of column visibility and filter tab in filament table. I have staff tab in ListRecord like that
'staff' => Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification'),
'staff' => Tab::make(trans('tab.staff'))
->modifyQueryUsing(fn (Builder $query)
=> $query->whereNotNull('staffID'))
->icon('heroicon-m-identification'),
When user click this tab I want to the staff coloumn in filament table. How can I?
2 replies
FFilament
Created by Shaung Bhone on 10/24/2023 in #❓┊help
How to add modal confirmation?
I am trying to add deactivated and activated user functionality with Toggle::make('is_activated'). Within this toggle, I am attempting to incorporate a modal confirmation when an admin deactivates a user account. How can I?
8 replies
FFilament
Created by Shaung Bhone on 10/15/2023 in #❓┊help
Using the enum label with a text column in my table.
If you use a TextColumn with the Table Builder, and it is cast to an enum in your Eloquent model, Filament will automatically use the HasLabel interface to display the enum's label instead of its raw value.
If you use a TextColumn with the Table Builder, and it is cast to an enum in your Eloquent model, Filament will automatically use the HasLabel interface to display the enum's label instead of its raw value.
I read the doc. That not work for me. Where am I do wrong? CompanyResource.php
Tables\Columns\TextColumn::make('type'),
Tables\Columns\TextColumn::make('type'),
Company.php
protected $casts = [
'type' => EmploymentType::class,
];
protected $casts = [
'type' => EmploymentType::class,
];
33 replies
FFilament
Created by Shaung Bhone on 10/4/2023 in #❓┊help
Adding a table to a Livewire component
Typed property App\Livewire\Company\CompanyList::$user must not be accessed before initialization I got the above error. I'm trying to show the users who belong to companies. I've no idea.
<?php

namespace App\Livewire\Company;


class CompanyList extends Component implements Forms\Contracts\HasForms, Tables\Contracts\HasTable
{
use Forms\Concerns\InteractsWithForms;
use Tables\Concerns\InteractsWithTable;

public User $user;

public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->companies())
->columns([
Tables\Columns\ImageColumn::make('company_logo_path')
->label('Company Logo'),
Tables\Columns\TextColumn::make('name')
->label(__('translations.field.company_name')),
Tables\Columns\TextColumn::make('email')
->label(__('translations.field.email')),
Tables\Columns\TextColumn::make('location')
->label(__('translations.field.location')),
]),
//
}

public function render(): View
{
return view('livewire.company.company-list')->layout('layouts.profile-layout');
}
}
<?php

namespace App\Livewire\Company;


class CompanyList extends Component implements Forms\Contracts\HasForms, Tables\Contracts\HasTable
{
use Forms\Concerns\InteractsWithForms;
use Tables\Concerns\InteractsWithTable;

public User $user;

public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->companies())
->columns([
Tables\Columns\ImageColumn::make('company_logo_path')
->label('Company Logo'),
Tables\Columns\TextColumn::make('name')
->label(__('translations.field.company_name')),
Tables\Columns\TextColumn::make('email')
->label(__('translations.field.email')),
Tables\Columns\TextColumn::make('location')
->label(__('translations.field.location')),
]),
//
}

public function render(): View
{
return view('livewire.company.company-list')->layout('layouts.profile-layout');
}
}
4 replies
FFilament
Created by Shaung Bhone on 9/12/2023 in #❓┊help
How to test repeater value in filament form?
Please confirmed my test is good or not? Please suggest how to test repeater in filament?
livewire(Create::class)
->fillForm([
'name' => fake()->word(),
'document' => fake()->file('public'),
'bio' => fake()->sentence(),
'experience' => [
['job_title' => fake()->word()],
['company_name' => fake()->word()],
['description' => fake()->sentence()]
]
])
->call('create')
->assertStatus(200);
livewire(Create::class)
->fillForm([
'name' => fake()->word(),
'document' => fake()->file('public'),
'bio' => fake()->sentence(),
'experience' => [
['job_title' => fake()->word()],
['company_name' => fake()->word()],
['description' => fake()->sentence()]
]
])
->call('create')
->assertStatus(200);
18 replies