mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
040ace12be
commit
39b5a8484e
3 changed files with 60 additions and 27 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
use app\Filament\Resources\HostingSubscriptionResource\Pages\ManageHostingSubscriptionFileManager;
|
||||
use app\Filament\Resources\HostingSubscriptionResource\Pages\ManageHostingSubscriptionFtpAccounts;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Domain;
|
||||
|
@ -190,7 +191,8 @@ class HostingSubscriptionResource extends Resource
|
|||
Pages\EditHostingSubscription::class,
|
||||
Pages\ManageHostingSubscriptionDatabases::class,
|
||||
Pages\ManageHostingSubscriptionBackups::class,
|
||||
ManageHostingSubscriptionFtpAccounts::class
|
||||
Pages\ManageHostingSubscriptionFtpAccounts::class,
|
||||
Pages\ManageHostingSubscriptionFileManager::class
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -208,10 +210,11 @@ class HostingSubscriptionResource extends Resource
|
|||
'index' => Pages\ListHostingSubscriptions::route('/'),
|
||||
'create' => Pages\CreateHostingSubscription::route('/create'),
|
||||
'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
|
||||
'view' => Pages\ViewHostingSubscription::route('/{record}'),
|
||||
// 'view' => Pages\ViewHostingSubscription::route('/{record}'),
|
||||
'databases' => Pages\ManageHostingSubscriptionDatabases::route('/{record}/databases'),
|
||||
'backups' => Pages\ManageHostingSubscriptionBackups::route('/{record}/backups'),
|
||||
'ftp-accounts' => Pages\ManageHostingSubscriptionFtpAccounts::route('/{record}/ftp-accounts'),
|
||||
'file-manager' => Pages\ManageHostingSubscriptionFileManager::route('/{record}/file-manager'),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,48 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\HostingSubscriptionResource;
|
||||
use App\Models\Domain;
|
||||
use App\Models\FileItem;
|
||||
use App\Models\HostingSubscription;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Resources\Pages\ManageRelatedRecords;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Tables\Actions\Action;
|
||||
use Filament\Tables\Actions\ActionGroup;
|
||||
use Filament\Tables\Actions\BulkAction;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\HeaderActionsPosition;
|
||||
use Filament\Tables\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Number;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
|
||||
class FileManager extends Page implements HasTable
|
||||
class ManageHostingSubscriptionFileManager extends ViewRecord implements HasTable
|
||||
{
|
||||
use InteractsWithTable;
|
||||
|
||||
protected static string $resource = HostingSubscriptionResource::class;
|
||||
|
||||
protected static string $relationship = 'fileManager';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-folder-open';
|
||||
|
||||
protected static string $view = 'filament.pages.file-manager';
|
||||
|
||||
protected string $disk = 'local';
|
||||
public string $disk = 'local';
|
||||
|
||||
#[Url(except: '')]
|
||||
public string $path = '';
|
||||
|
||||
protected $listeners = ['updatePath' => '$refresh'];
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
$recordTitle = $this->getRecordTitle();
|
||||
|
||||
$recordTitle = $recordTitle instanceof Htmlable ? $recordTitle->toHtml() : $recordTitle;
|
||||
|
||||
return "File Manager {$recordTitle} ";
|
||||
}
|
||||
|
||||
public function getBreadcrumb(): string
|
||||
{
|
||||
return 'File Manager';
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'File Manager';
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
$hostingSubscription = HostingSubscription::where('id', 16)->first();
|
||||
$findDomain = Domain::where('hosting_subscription_id', $hostingSubscription->id)->where('is_main',1)->first();
|
||||
$hostingSubscription = HostingSubscription::select(['id'])->where('id', 16)->first();
|
||||
$findDomain = Domain::select(['home_root', 'hosting_subscription_id', 'is_main'])->where('hosting_subscription_id', $hostingSubscription->id)->where('is_main',1)->first();
|
||||
$this->disk = $findDomain->home_root;
|
||||
|
||||
$storage = Storage::build([
|
||||
|
@ -52,7 +79,8 @@ class FileManager extends Page implements HasTable
|
|||
]);
|
||||
|
||||
return $table
|
||||
->heading($this->path ?: 'Root')
|
||||
->deferLoading()
|
||||
->heading($this->disk .'/'. $this->path ?: 'Root')
|
||||
->query(
|
||||
FileItem::queryForDiskAndPath($this->disk, $this->path)
|
||||
)
|
||||
|
@ -116,6 +144,7 @@ class FileManager extends Page implements HasTable
|
|||
}),
|
||||
])
|
||||
->checkIfRecordIsSelectableUsing(fn (FileItem $record): bool => ! $record->isPreviousPath())
|
||||
->headerActionsPosition(HeaderActionsPosition::Bottom)
|
||||
->headerActions([
|
||||
Action::make('create_folder')
|
||||
->label('Create Folder')
|
|
@ -109,5 +109,6 @@ class FileItem extends Model
|
|||
]
|
||||
)
|
||||
)->toArray();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue