Jpac14
Jpac14
Explore posts from servers
FFilament
Created by Jpac14 on 1/20/2025 in #❓┊help
Assign role not working with filament shield
4 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
I have this form schema
Toggle::make('includeTable')
->label('Include table')
->default(true)
->reactive()
->live(),
Toggle::make('includeChart')
->label('Include chart')
->default(false)
->reactive()
->live(),
Select::make('animation')
->label('Animation')
->options([
'none' => 'None',
'confetti' => 'Confetti',
'Fireworks' => 'Fireworks',
])
->default('none')
->reactive()
->live()
->columnSpanFull(),
TextInput::make('url')
->label('URL')
->readOnly()
Toggle::make('includeTable')
->label('Include table')
->default(true)
->reactive()
->live(),
Toggle::make('includeChart')
->label('Include chart')
->default(false)
->reactive()
->live(),
Select::make('animation')
->label('Animation')
->options([
'none' => 'None',
'confetti' => 'Confetti',
'Fireworks' => 'Fireworks',
])
->default('none')
->reactive()
->live()
->columnSpanFull(),
TextInput::make('url')
->label('URL')
->readOnly()
I would like to update the url text input, based off the other input like crafting a url, localhost:8000/embed?animation=fireworks
12 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
Hi guys, I have this code that will make the favicon the same as the logo when the checkbox is checked. If this is checked I want to disable the file input for favicon. Don't worry about the TenantFileUpload it is exactly the same as FileUpload just with changed saving.
return [
TextInput::make('name')
->label('Name')
->required(),
ColorSwatchInput::make('primary_color')
->label('Primary Color')
->required(),
TenantFileUpload::make('logo')
->label('Logo')
->image()
->maxSize(2048) // 2MB
->maxFiles(1)
->live(),
Checkbox::make('logo_same_as_favicon')
->live()
->disabled(fn (Get $get) => empty($get('logo')))
->afterStateUpdated(function (bool $state, Set $set) {
if ($state) {
$set('favicon', []);
}
}),
TenantFileUpload::make('favicon')
->label('Favicon')
->helperText('A small icon that appears in the browser tab')
->image()
->maxSize(2048) // 2MB
->maxFiles(1)
->disabled(fn (Get $get) => $get('logo_same_as_favicon')),
];
}
return [
TextInput::make('name')
->label('Name')
->required(),
ColorSwatchInput::make('primary_color')
->label('Primary Color')
->required(),
TenantFileUpload::make('logo')
->label('Logo')
->image()
->maxSize(2048) // 2MB
->maxFiles(1)
->live(),
Checkbox::make('logo_same_as_favicon')
->live()
->disabled(fn (Get $get) => empty($get('logo')))
->afterStateUpdated(function (bool $state, Set $set) {
if ($state) {
$set('favicon', []);
}
}),
TenantFileUpload::make('favicon')
->label('Favicon')
->helperText('A small icon that appears in the browser tab')
->image()
->maxSize(2048) // 2MB
->maxFiles(1)
->disabled(fn (Get $get) => $get('logo_same_as_favicon')),
];
}
^^ this is code for the schema and this is the page below
10 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
Hi All, I am using stancl tenancy with filament. I have this custom page to change the branding of the tenant. Code Below:
class Branding extends Page implements HasForms
{
use InteractsWithForms;
use WithFileUploads;

protected static ?string $navigationIcon = 'heroicon-o-paint-brush';

protected static ?string $navigationGroup = 'Settings';

protected static string $view = 'filament.tenant.pages.branding';

public ?array $data = [];

public function mount(): void
{
// TODO: fill existing images or allow users to clear

$this->form->fill([
'name' => tenant('name'),
'primary_color' => tenant('primary_color'),
'logo' => tenant_asset(tenant('logo')),
'favicon' => tenant_asset('favicon'),
]);
}

public function form(Form $form): Form
{
return $form->schema(BrandingForm::schema())->statePath('data');
}

public function submit()
{
$this->validate();

if (!empty($this->data['logo'])) {
reset($this->data['logo']);
$logo = current($this->data['logo']);
$logoUrl = $logo->store('logos', 'public');
} else {
$logoUrl = tenant('logo');
}

if (!empty($this->data['favicon'])) {
reset($this->data['favicon']);
$favicon = current($this->data['favicon']);
$faviconUrl = $favicon->store('favicons', 'public');
} else {
$faviconUrl = tenant('favicon');
}

tenant()->update([
'name' => $this->data['name'],
'primary_color' => $this->data['primary_color'],
'logo' => $logoUrl,
'favicon' => $faviconUrl,
]);

Notification::make()
->title('Branding updated')
->success()
->send();

$this->dispatch('reload');
}
}
class Branding extends Page implements HasForms
{
use InteractsWithForms;
use WithFileUploads;

protected static ?string $navigationIcon = 'heroicon-o-paint-brush';

protected static ?string $navigationGroup = 'Settings';

protected static string $view = 'filament.tenant.pages.branding';

public ?array $data = [];

public function mount(): void
{
// TODO: fill existing images or allow users to clear

$this->form->fill([
'name' => tenant('name'),
'primary_color' => tenant('primary_color'),
'logo' => tenant_asset(tenant('logo')),
'favicon' => tenant_asset('favicon'),
]);
}

public function form(Form $form): Form
{
return $form->schema(BrandingForm::schema())->statePath('data');
}

public function submit()
{
$this->validate();

if (!empty($this->data['logo'])) {
reset($this->data['logo']);
$logo = current($this->data['logo']);
$logoUrl = $logo->store('logos', 'public');
} else {
$logoUrl = tenant('logo');
}

if (!empty($this->data['favicon'])) {
reset($this->data['favicon']);
$favicon = current($this->data['favicon']);
$faviconUrl = $favicon->store('favicons', 'public');
} else {
$faviconUrl = tenant('favicon');
}

tenant()->update([
'name' => $this->data['name'],
'primary_color' => $this->data['primary_color'],
'logo' => $logoUrl,
'favicon' => $faviconUrl,
]);

Notification::make()
->title('Branding updated')
->success()
->send();

$this->dispatch('reload');
}
}
9 replies
FFilament
Created by Jpac14 on 11/24/2024 in #❓┊help
Can I add an import action to a wizard form
Wizard\Step::make('Students')
->icon('heroicon-o-academic-cap')
->schema([
Actions::make([
ImportAction::make(StudentImporter::class)
])
])
Wizard\Step::make('Students')
->icon('heroicon-o-academic-cap')
->schema([
Actions::make([
ImportAction::make(StudentImporter::class)
])
])
I have this at the moment, but when I load the page I get this error
PHP 8.1.29
10.48.20
Filament\Forms\Components\Actions::Filament\Forms\Components\{closure}(): Argument #1 ($action) must be of type Filament\Forms\Components\Actions\Action, Filament\Actions\ImportAction given
PHP 8.1.29
10.48.20
Filament\Forms\Components\Actions::Filament\Forms\Components\{closure}(): Argument #1 ($action) must be of type Filament\Forms\Components\Actions\Action, Filament\Actions\ImportAction given
https://flareapp.io/share/bP9oERM5
8 replies
FFilament
Created by Jpac14 on 11/21/2024 in #❓┊help
Is it possible to customise the theme, when using web.php?
No description
8 replies
FFilament
Created by Jpac14 on 10/2/2024 in #❓┊help
Disable tenant slug
Hey everybody, I am trying to get stancl/tenancy and filament working together. I have all the images and all that working, but I am trying to use your tenancy pages (https://filamentphp.com/docs/3.x/panels/tenancy#overview), like signup and that. But I also want to use their billing features. the problem is I have this so far
return $panel
->default()
->id('tenant')
->path('')
->login()
->brandName(fn () => tenant('name'))
->brandLogo(fn () => tenant_asset(tenant('logo')))
->favicon(fn () => tenant_asset(tenant('favicon')))
->tenant(Tenant::class, slugAttribute: null)
return $panel
->default()
->id('tenant')
->path('')
->login()
->brandName(fn () => tenant('name'))
->brandLogo(fn () => tenant_asset(tenant('logo')))
->favicon(fn () => tenant_asset(tenant('favicon')))
->tenant(Tenant::class, slugAttribute: null)
But I want to turn off the added slug, because it I am using subdomain identification from stancl. And when once I login I get redirect to a page that doesn't exist. is this somehow possible to combine both worlds, use the billing and tenant signup pages + stancl? I can provided any other files if needed. Any help would be appreciated.
15 replies
FFilament
Created by Jpac14 on 8/22/2024 in #❓┊help
How can I pass a URL to Widget on panel initialisation?
I want to add quicklinks to my dashboard and have created a custom widget to do so. This is the code I have so far
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;

class QuickLinkWidget extends Widget
{
protected static string $view = 'widgets.quick-link-widget';

public $title;
public $icon;
public $description;
public $url;
}
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;

class QuickLinkWidget extends Widget
{
protected static string $view = 'widgets.quick-link-widget';

public $title;
public $icon;
public $description;
public $url;
}
<a href={{ $url }}>
<x-filament-widgets::widget>
<x-filament::section>
<div class="flex gap-4 items-center">
@svg($icon, 'h-8 w-8 text-gray-500')
<div>
<span class="font-bold">{{ $title }}</span>
<p class="text-xs text-gray-500">{{ $description }}</p>
</div>
</div>
</x-filament::section>
</x-filament-widgets::widget>
</a>
<a href={{ $url }}>
<x-filament-widgets::widget>
<x-filament::section>
<div class="flex gap-4 items-center">
@svg($icon, 'h-8 w-8 text-gray-500')
<div>
<span class="font-bold">{{ $title }}</span>
<p class="text-xs text-gray-500">{{ $description }}</p>
</div>
</div>
</x-filament::section>
</x-filament-widgets::widget>
</a>
->widgets([
Widgets\AccountWidget::class,
PointsTallyWidget::class,
QuickLinkWidget::make([
'title' => 'Add Points',
'icon' => 'heroicon-o-plus-circle',
'description' => 'Add points to students',
'url' => AddPointsByStudent::getUrl(),
])
])
->widgets([
Widgets\AccountWidget::class,
PointsTallyWidget::class,
QuickLinkWidget::make([
'title' => 'Add Points',
'icon' => 'heroicon-o-plus-circle',
'description' => 'Add points to students',
'url' => AddPointsByStudent::getUrl(),
])
])
in AdminPanelProvider.php But when I try this code I get this error Call to a member function generateRouteName() on null https://flareapp.io/share/87nLqw4m#top I am guessing it because the ::getUrl doesn't work to the panel is initalised is there any way to fix or get around this. any help appreciated thanks
6 replies
FFilament
Created by Jpac14 on 8/21/2024 in #❓┊help
Is it possible to change the background of each like little tag indiviually dependening on the optio
No description
3 replies
DIdiscord.js - Imagine ❄
Created by Jpac14 on 5/4/2024 in #djs-questions
Can I use the API to access /users/@me
I was looking at the documentation and was looking through the API class in core package, and noticed that it has a usersapi but no functon for /users/@me instead you must provide and ID, is there an alternative? I doing OAUTH stuff want to access user details on behalf of them.
7 replies