Flo
Flo
Explore posts from servers
FFilament
Created by Flo on 12/26/2023 in #❓┊help
Disable sub-navigation on specify page
thank you @DrByte for your time
11 replies
FFilament
Created by Flo on 12/26/2023 in #❓┊help
Disable sub-navigation on specify page
Ok, I have the solution. In the ViewRecord page, add this:
public function getSubNavigation(): array
{
return [];
}
public function getSubNavigation(): array
{
return [];
}
11 replies
FFilament
Created by Flo on 12/26/2023 in #❓┊help
Disable sub-navigation on specify page
I tried with shouldRegisterNavigation() set to false in ViewProvisioningServer but the sub-navigation still appears. I think shouldRegisterNavigation() is just to display ViewProvisioningServer in the menu, but not to remove the menu itself. I haven't seen anything that could help me in dd($page)
11 replies
FFilament
Created by Flo on 12/26/2023 in #❓┊help
Disable sub-navigation on specify page
public static function getRecordSubNavigation(Page $page): array
{
return $page->generateNavigationItems([
Pages\ListSitesServer::class,
Pages\DatabaseServer::class,
Pages\CronServer::class,
Pages\DaemonServer::class,
Pages\FirewallRulesServer::class,
Pages\BackupServer::class,
Pages\SoftwareServer::class,
Pages\FileServer::class,
Pages\LogServer::class,
Pages\EditServer::class,
]);
}
public static function getRecordSubNavigation(Page $page): array
{
return $page->generateNavigationItems([
Pages\ListSitesServer::class,
Pages\DatabaseServer::class,
Pages\CronServer::class,
Pages\DaemonServer::class,
Pages\FirewallRulesServer::class,
Pages\BackupServer::class,
Pages\SoftwareServer::class,
Pages\FileServer::class,
Pages\LogServer::class,
Pages\EditServer::class,
]);
}
On my ServerResource. As you see, there is no ViewProvisioningServer page. But on this page, the sub-navigation appears, which seems to be normal, but I would like to deactivate it right here.
11 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
I don't know why but it works now... I didn't do anything in particular so I suspect the cache... it's frustrating not knowing the reason
public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->label('Test')
->form([
TextInput::make('name'),
])
->action(fn (array $data) => dd($data)),
])
->paginated(false);
}
public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->label('Test')
->form([
TextInput::make('name'),
])
->action(fn (array $data) => dd($data)),
])
->paginated(false);
}
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
@Dennis Koch sorry to ping you, but we can't find the reason for this problem... no error message is displayed. Am I doing something wrong?
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
I always have the same result. In the browser console, /livewire/update is called in post, but nothing is displayed (like in the video)
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
For information, Software is a model using sushi:
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Sushi\Sushi;

class Software extends Model
{
use Sushi;

protected static array $softwares = [];

public static function queryForSoftwares(Server $server): Builder
{
static::$softwares = $server->installedSoftware()->toArray();

return static::query();
}

public function getRows(): array
{
return collect(static::$softwares)->map(function ($software) {
return [
'id' => $software->value,
'name' => $software->getDisplayName(),
'hasRestartTask' => (bool) $software->restartTaskClass(),
'hasUpdateAlternativesTask' => (bool) $software->updateAlternativesTask(),
];
})->toArray();
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Sushi\Sushi;

class Software extends Model
{
use Sushi;

protected static array $softwares = [];

public static function queryForSoftwares(Server $server): Builder
{
static::$softwares = $server->installedSoftware()->toArray();

return static::query();
}

public function getRows(): array
{
return collect(static::$softwares)->map(function ($software) {
return [
'id' => $software->value,
'name' => $software->getDisplayName(),
'hasRestartTask' => (bool) $software->restartTaskClass(),
'hasUpdateAlternativesTask' => (bool) $software->updateAlternativesTask(),
];
})->toArray();
}
}
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
My actually code :
class SoftwareServer extends Page implements HasTable
{
use InteractsWithRecord, InteractsWithTable;

protected static string $resource = ServerResource::class;

protected static string $view = 'filament.resources.server-resource.pages.software-server';

protected static ?string $title = 'Softwares';

protected static ?string $navigationIcon = 'heroicon-s-code-bracket';

public function mount(int|string $record): void
{
$this->record = $this->resolveRecord($record);

static::authorizeResourceAccess();
}

public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->modalContent(fn (Software $software): View => view('livewire.view-file'))
->action(fn () => dd('test')),
])
->paginated(false);
}
}
class SoftwareServer extends Page implements HasTable
{
use InteractsWithRecord, InteractsWithTable;

protected static string $resource = ServerResource::class;

protected static string $view = 'filament.resources.server-resource.pages.software-server';

protected static ?string $title = 'Softwares';

protected static ?string $navigationIcon = 'heroicon-s-code-bracket';

public function mount(int|string $record): void
{
$this->record = $this->resolveRecord($record);

static::authorizeResourceAccess();
}

public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->modalContent(fn (Software $software): View => view('livewire.view-file'))
->action(fn () => dd('test')),
])
->paginated(false);
}
}
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
Even deleting it doesn't work
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
I also tried the following code without success:
public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->modalContent(fn (Software $software): View => view('livewire.view-file'))
->action(fn () => dd('test')),
])
->paginated(false);
}
public function table(Table $table): Table
{
return $table
->query(Software::queryForSoftwares($this->getRecord()))
->columns([
TextColumn::make('name'),
])
->actions([
Action::make('test')
->modalContent(fn (Software $software): View => view('livewire.view-file'))
->action(fn () => dd('test')),
])
->paginated(false);
}
20 replies
FFilament
Created by Flo on 12/21/2023 in #❓┊help
Modal does not work in a Custom Page
not working
20 replies
FFilament
Created by Flo on 12/19/2023 in #❓┊help
Widget Table "Cannot use "::class" on null" error
Ok, it was just my query that was not correct, here is what works:
class CreateDatabaseUserWidget extends BaseWidget
{
public Server $server;

public function table(Table $table): Table
{
return $table
->query(DatabaseUser::query()->where('server_id', $this->server->id))
->columns([
TextColumn::make('id'),
]);
}
}
class CreateDatabaseUserWidget extends BaseWidget
{
public Server $server;

public function table(Table $table): Table
{
return $table
->query(DatabaseUser::query()->where('server_id', $this->server->id))
->columns([
TextColumn::make('id'),
]);
}
}
3 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
Thank you Dan !
77 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
but why ?
77 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
Yes, anything that extends from "ManageRelatedRecords", "EditRecord", "ListRecords", "ViewRecord" works, but not if it extends from "Page"
77 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
What exactly did you do? I use "npm run dev" in the background.
77 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
For me, it still doesn't work. Should I add something here? log-server.blade.php
<x-filament-panels::page>

</x-filament-panels::page>
<x-filament-panels::page>

</x-filament-panels::page>
77 replies
FFilament
Created by myster on 11/30/2023 in #❓┊help
Sub navigation
(For me, it appears well on classic "view, edit..." pages but not on custom pages, and I think it's because of my view. But what to add there?)
77 replies