tarifss
Explore posts from serversDelete action is not working
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\EditAction::make('category_update')->visible(auth()->user()->can('category_update')),
Tables\Actions\DeleteAction::make('category_delete')->visible(auth()->user()->can('category_delete'))
->before(function (Action $action,Category $record) {
if ($record->products()->exists() || $record->childrens()->exists()){
Notification::make()
->title("Can't delete")
->body('' . $record->name . ' Category Added to a Product or has children')
->danger()
->send();
$action->halt();
}
}),
]),
])
17 replies
Delete action is not working
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\EditAction::make('category_update')->visible(auth()->user()->can('category_update')),
Tables\Actions\DeleteAction::make('category_delete')->visible(auth()->user()->can('category_delete'))
->before(function (Action $action,Category $record) {
if ($record->products()->exists() || $record->childrens()->exists()){
Notification::make()
->title("Can't delete")
->body('' . $record->name . ' Category Added to a Product or has children')
->danger()
->send();
$action->halt();
}
})
->after(function (Action $action,Category $record) {
$record->delete();
Notification::make()
->title('Delete')
->body('' . $record->name . ' Category Deleted')
->danger()
->send();
}),
]),
])
17 replies
Delete action is not working
got this error again for this code Filament\Resources\Pages\ListRecords::Filament\Resources\Pages{closure}(): Argument #1 ($record) must be of type Illuminate\Database\Eloquent\Model, null given, called in /var/www/html/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
17 replies
Delete action is not working
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\EditAction::make()->visible(auth()->user()->can('category_update')),
Tables\Actions\DeleteAction::make()->visible(auth()->user()->can('category_delete'))
->action(function (Category $record) {
if ($record->products()->exists() || $record->childrens()->exists()) {
Notification::make()
->title('Can't delete')
->body('' . $record->name . ' Category Added to a Product or has children')
->danger()
->send();
return;
} else {
$record->delete();
Notification::make()
->title('Delete')
->body('' . $record->name . ' Category Deleted')
->danger()
->send();
}
}),
]),
])
17 replies
upgrade v2 to v3
after composer update completed then getting this error
PHP Fatal error: Type of App\Filament\Resources\Product\ProductResource\Pages\CreateProduct::$attributes must be Livewire\Features\SupportAttributes\AttributeCollection (as in class Livewire\Component) in /var/www/html/app/Filament/Resources/Product/ProductResource/Pages/CreateProduct.php on line 22
Symfony\Component\ErrorHandler\Error\FatalError
Type of App\Filament\Resources\Product\ProductResource\Pages\CreateProduct::$attributes must be Livewire\Features\SupportAttributes\AttributeCollection (as in class Livewire\Component)
5 replies