Finished user table
This commit is contained in:
parent
f122f2925a
commit
056462f511
@ -102,6 +102,11 @@ public static function table(Table $table): Table
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -83,6 +83,11 @@ public static function table(Table $table): Table
|
||||
->actions([]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -233,6 +233,11 @@ public static function table(Table $table): Table
|
||||
->selectCurrentPageOnly();
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
@ -249,9 +254,4 @@ public static function getPages(): array
|
||||
'edit' => \App\Filament\Admin\Resources\InvoiceResource\Pages\EditInvoice::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return parent::canAccess(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,11 @@ public static function table(Table $table): Table
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -108,6 +108,11 @@ public static function table(Table $table): Table
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -3,6 +3,9 @@
|
||||
namespace App\Filament\Admin\Resources;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
@ -23,7 +26,29 @@ public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
Section::make()
|
||||
->schema([
|
||||
TextInput::make('username')
|
||||
->autocomplete(false)
|
||||
->required(),
|
||||
|
||||
TextInput::make('password')
|
||||
->password()
|
||||
->autocomplete(false)
|
||||
->dehydrated(fn ($state) => ! empty($state))
|
||||
->required(fn (string $operation): bool => $operation === 'create'),
|
||||
|
||||
TextInput::make('password_verify')
|
||||
->label('Verify password')
|
||||
->password()
|
||||
->same('password')
|
||||
->dehydrated(false)
|
||||
->autocomplete(false)
|
||||
->required(fn (string $operation) => $operation === 'create'),
|
||||
|
||||
Checkbox::make('is_admin')
|
||||
->disabled(fn (User $record) => auth()->user()->id === $record->id),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -31,12 +56,12 @@ public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('username')
|
||||
->extraHeaderAttributes(['class' => 'w-full']),
|
||||
Tables\Columns\IconColumn::make('is_admin')
|
||||
->label('Admin')
|
||||
->boolean()
|
||||
->alignRight(),
|
||||
TextColumn::make('username')
|
||||
->extraHeaderAttributes(['class' => 'w-full']),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
@ -51,6 +76,11 @@ public static function table(Table $table): Table
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->is_admin;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Models\Contracts\HasName;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
Loading…
x
Reference in New Issue
Block a user