mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
bec60c518f
commit
10f04df2d2
6 changed files with 139 additions and 5 deletions
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Resources;
|
||||
|
||||
use App\Models\Database;
|
||||
use Modules\Customer\App\Filament\Resources\DatabaseResource\Pages;
|
||||
use Modules\Customer\App\Filament\Resources\DatabaseResource\RelationManagers;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class DatabaseResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Database::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-circle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
|
||||
Tables\Columns\TextColumn::make('database_name')
|
||||
->prefix(function ($record) {
|
||||
return $record->database_name_prefix;
|
||||
})
|
||||
->label('Database Name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('databaseUsers.username')
|
||||
->label('Database Users')
|
||||
->listWithLineBreaks()
|
||||
->limitList(2)
|
||||
->expandableLimitedList(),
|
||||
|
||||
Tables\Columns\TextColumn::make('is_remote_database_server')
|
||||
->badge()
|
||||
->state(fn($record) => $record->is_remote_database_server ? 'Remote Database Server' : 'Internal Database Server')
|
||||
->label('Database Server')
|
||||
->sortable(),
|
||||
|
||||
])
|
||||
->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\ListDatabases::route('/'),
|
||||
'create' => Pages\CreateDatabase::route('/create'),
|
||||
'edit' => Pages\EditDatabase::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Resources\DatabaseResource\Pages;
|
||||
|
||||
use Modules\Customer\App\Filament\Resources\DatabaseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDatabase extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DatabaseResource::class;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Resources\DatabaseResource\Pages;
|
||||
|
||||
use Modules\Customer\App\Filament\Resources\DatabaseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDatabase extends EditRecord
|
||||
{
|
||||
protected static string $resource = DatabaseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Resources\DatabaseResource\Pages;
|
||||
|
||||
use Modules\Customer\App\Filament\Resources\DatabaseResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDatabases extends ListRecords
|
||||
{
|
||||
protected static string $resource = DatabaseResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace Modules\Customer\App\Providers;
|
|||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Customer\Providers\Filament\CustomerPanelProvider;
|
||||
use Modules\Customer\App\Providers\Filament\CustomerPanelProvider;
|
||||
|
||||
class CustomerServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\Providers\Filament;
|
||||
namespace Modules\Customer\App\Providers\Filament;
|
||||
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
|
@ -53,12 +53,12 @@ class CustomerPanelProvider extends PanelProvider
|
|||
->colors([
|
||||
'primary'=>$defaultColor,
|
||||
])
|
||||
->discoverResources(in: module_path($this->module, 'Filament/Admin/Resources'), for: "$moduleNamespace\\Filament\\Admin\\Resources")
|
||||
->discoverPages(in: module_path($this->module, 'Filament/Admin/Pages'), for: "$moduleNamespace\\Filament\\Admin\\Pages")
|
||||
->discoverResources(in: module_path($this->module, 'App/Filament/Resources'), for: "$moduleNamespace\\App\\Filament\\Resources")
|
||||
->discoverPages(in: module_path($this->module, 'App/Filament/Pages'), for: "$moduleNamespace\\App\Filament\\Pages")
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
])
|
||||
->discoverWidgets(in: module_path($this->module, 'Filament/Admin/Widgets'), for: "$moduleNamespace\\Filament\\Admin\\Widgets")
|
||||
->discoverWidgets(in: module_path($this->module, 'App/Filament/Widgets'), for: "$moduleNamespace\\App\Filament\\Widgets")
|
||||
->widgets([
|
||||
Widgets\AccountWidget::class,
|
||||
Widgets\FilamentInfoWidget::class,
|
Loading…
Reference in a new issue