Filament 3 edit button not showing in resource

i made a resource called Team and i want to be able to edit my teams from the admin panel so it also shows up in my jetstream application but the edit action button isn't showing up but it does show up on my user resource. i tried reinstalling it but it still doesn't work
No description
No description
No description
Solution:
```php <?php namespace App\Filament\Resources; ...
Jump to solution
48 Replies
Matthew
Matthew14mo ago
You have imported the wrong EditAction xd. Its not Filament use Filament\Tables\Actions\EditAction; but Tables\Actions\EditAction Quick delete? I was about to respond lol
MRB_KILLER
MRB_KILLEROP14mo ago
i did it but it still doesn't work
No description
No description
Matthew
Matthew14mo ago
It works for me
Matthew
Matthew14mo ago
No description
Matthew
Matthew14mo ago
What are you trying to do in the action? Im pretty sure you cant call form()
MRB_KILLER
MRB_KILLEROP14mo ago
make the edit button show up it does work on my User resource
Matthew
Matthew14mo ago
Remove the form, just keep it as EditAction
MRB_KILLER
MRB_KILLEROP14mo ago
this is my UserResource.php
No description
Matthew
Matthew14mo ago
yeah, so why call a form?
MRB_KILLER
MRB_KILLEROP14mo ago
im new to filament i just followed a tutorial but that guy explained it badly or i didnt follow him well enough 😄
MRB_KILLER
MRB_KILLEROP14mo ago
when i do it like this it still doesnt work
No description
Matthew
Matthew14mo ago
Filament handles the edit automatically. Unless you want to do something very specific, you dont have to touch anything Nooo, when I said remove the form, I didnt mean just the word, but everything that is in it. Just leave it as Tables\Actions\EditAction::make()
MRB_KILLER
MRB_KILLEROP14mo ago
like this?
No description
Matthew
Matthew14mo ago
yess
MRB_KILLER
MRB_KILLEROP14mo ago
it still doesnt work
Matthew
Matthew14mo ago
What is the issue now?
MRB_KILLER
MRB_KILLEROP14mo ago
i don't really know
MRB_KILLER
MRB_KILLEROP14mo ago
No description
MRB_KILLER
MRB_KILLEROP14mo ago
it just shows up like this
Matthew
Matthew14mo ago
wierd. Are you sure you saved the file?
MRB_KILLER
MRB_KILLEROP14mo ago
i double saved it
Matthew
Matthew14mo ago
Hmm, can you share the code here? I want to thorougly read the imports. If you do, send it as ```php ````
MRB_KILLER
MRB_KILLEROP14mo ago
i'm sorry i dont know how to do that
Matthew
Matthew14mo ago
Can you share the EditTeams.php?
Matthew
Matthew14mo ago
That looks ok. Can you do tge same with the resource file?
Matthew
Matthew14mo ago
Can you check which version of filament you are on? php artisan about
MRB_KILLER
MRB_KILLEROP14mo ago
3.0.81 its v3
Matthew
Matthew14mo ago
Ok. I think I found it. Try the following:
use Filament\Tables\Columns\TextColumn;

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("user_id"),
TextColumn::make("name"),
TextColumn::make("personal_team"),
TextColumn::make("created_at"),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make()
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
use Filament\Tables\Columns\TextColumn;

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("user_id"),
TextColumn::make("name"),
TextColumn::make("personal_team"),
TextColumn::make("created_at"),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make()
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
Make sure you change the import for the column
MRB_KILLER
MRB_KILLEROP14mo ago
uhhhh it still doesnt work
MRB_KILLER
MRB_KILLEROP14mo ago
No description
MRB_KILLER
MRB_KILLEROP14mo ago
i have a error in this file
No description
MRB_KILLER
MRB_KILLEROP14mo ago
but i didnt even touch it
MRB_KILLER
MRB_KILLEROP14mo ago
No description
toeknee
toeknee14mo ago
You sure you have permission to update?
MRB_KILLER
MRB_KILLEROP14mo ago
yes im logged in as a administrator
Matthew
Matthew14mo ago
sigh SOmething else is going on. I will make a Teams resource on my machine and when I get it working I will give you the code
MRB_KILLER
MRB_KILLEROP14mo ago
okay thank you for helpine me
Solution
Matthew
Matthew14mo ago
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\TeamsResource\Pages;
use App\Filament\Resources\TeamsResource\RelationManagers;
use App\Models\Teams;
use Filament\Forms;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class TeamResource extends Resource
{
protected static ?string $model = Team::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("name"),
// ...
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListTeam::route('/'),
'create' => Pages\CreateTeam::route('/create'),
'edit' => Pages\EditTeam::route('/{record}/edit'),
];
}
}
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\TeamsResource\Pages;
use App\Filament\Resources\TeamsResource\RelationManagers;
use App\Models\Teams;
use Filament\Forms;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class TeamResource extends Resource
{
protected static ?string $model = Team::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("name"),
// ...
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListTeam::route('/'),
'create' => Pages\CreateTeam::route('/create'),
'edit' => Pages\EditTeam::route('/{record}/edit'),
];
}
}
Matthew
Matthew14mo ago
This will work @MRB_KILLER
awcodes
awcodes14mo ago
This looks like a Policy issue to me.
Matthew
Matthew14mo ago
could be
MRB_KILLER
MRB_KILLEROP13mo ago
it works thank you
MRB_KILLER
MRB_KILLEROP13mo ago
now this shows up
No description
MRB_KILLER
MRB_KILLEROP13mo ago
this is my teamresource.php
No description
Matthew
Matthew13mo ago
You have to add columns to the model. Please read doc for that
Gally
Gally7mo ago
I have just ran into the same issue as yourself whilst trying to manage Jetstream Teams with Filament. The issue is with the Team policies. If you go to 'App\Policies\TeamPolicy.php' you can modify the logic for who has access to view and update Team models. For my application it was a case of adding the following check for my admin users who had access to Filament
Want results from more Discord servers?
Add your server