ocram82
ocram82
FFilament
Created by ocram82 on 7/2/2024 in #❓┊help
Filter parameter
hi all, i've a RelationManager: UsersRelationManager and in $table object i've this filter:
public function table(Table $table): Table
{
return $table
->->filters([
UserCastingStatusFilter::make('status_user_id'),
], layout: FiltersLayout::AboveContentCollapsible)

...
public function table(Table $table): Table
{
return $table
->->filters([
UserCastingStatusFilter::make('status_user_id'),
], layout: FiltersLayout::AboveContentCollapsible)

...
The relations from Users and Casting are this:
# User.php

public function castings(): BelongsToMany
{
return $this->belongsToMany(Casting::class)->withPivot('status_user_id', 'answer_user')->withTimestamps();
}
# User.php

public function castings(): BelongsToMany
{
return $this->belongsToMany(Casting::class)->withPivot('status_user_id', 'answer_user')->withTimestamps();
}
# Casting.php

public function users(): BelongsToMany
{
return $this->belongsToMany(User::class)->withTimestamps()->withPivot(['status_user_id', 'answer_user']);
}
# Casting.php

public function users(): BelongsToMany
{
return $this->belongsToMany(User::class)->withTimestamps()->withPivot(['status_user_id', 'answer_user']);
}
How can i call UserCastingStatusFilter with casting_id considering that i've the relationManager inside Casting page view?
2 replies
FFilament
Created by ocram82 on 6/26/2024 in #❓┊help
Export pdf with custom layout
hi, i want an action that give me the possibility to export a pdf of a user data. I just have those data and also custom template. But how can i export in pdf ? And what if fot have this action Bulk? how could i do?
18 replies
FFilament
Created by ocram82 on 6/21/2024 in #❓┊help
custom redirect after password reset
hi, i've the following class that works:
<?php

namespace App\Filament\Modelperson\Pages\Auth;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\Auth\PasswordReset\ResetPassword as BaseResetPassword;
use Filament\Http\Responses\Auth\Contracts\PasswordResetResponse;
use Illuminate\Database\Eloquent\Model;

class ResetPassword extends BaseResetPassword
{

public function form(Form $form): Form
{
return $form
->schema([
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
]);
}


public function resetPassword(): ?PasswordResetResponse
{
return parent::resetPassword();
}
}
<?php

namespace App\Filament\Modelperson\Pages\Auth;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\Auth\PasswordReset\ResetPassword as BaseResetPassword;
use Filament\Http\Responses\Auth\Contracts\PasswordResetResponse;
use Illuminate\Database\Eloquent\Model;

class ResetPassword extends BaseResetPassword
{

public function form(Form $form): Form
{
return $form
->schema([
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
]);
}


public function resetPassword(): ?PasswordResetResponse
{
return parent::resetPassword();
}
}
but how can i customize the redirection after password reset? thanks
4 replies
FFilament
Created by ocram82 on 6/19/2024 in #❓┊help
Get Model id on Widget
hi all, i've this widget:
class MessageWidgetTable extends BaseWidget
{
public function table(Table $table): Table
{
return $table
->heading('')
->query(
Message::query()->where('casting_id', 22)
)
->columns([
Tables\Columns\TextColumn::make('body')->label('Text')->limit(100),
Tables\Columns\TextColumn::make('created_at')->label('Send at')->dateTime('d M Y - H:i'),
])
->actions([
ViewAction::make()
->modalHeading('Text')
->infolist([
TextEntry::make('body')->markdown()->hiddenLabel(),
TextEntry::make('users_count')
->getStateUsing(fn ($record) => $record->users->count())
->label('N. Users that read at'),
RepeatableEntry::make('users')
->label('Readers')
->schema([
TextEntry::make('first_name')->hiddenLabel(),
TextEntry::make('last_name')->hiddenLabel(),
TextEntry::make('pivot.read_at')->date('d M Y - H:i')->hiddenLabel(),
])
->columns(3)
]),


]);
}

}
class MessageWidgetTable extends BaseWidget
{
public function table(Table $table): Table
{
return $table
->heading('')
->query(
Message::query()->where('casting_id', 22)
)
->columns([
Tables\Columns\TextColumn::make('body')->label('Text')->limit(100),
Tables\Columns\TextColumn::make('created_at')->label('Send at')->dateTime('d M Y - H:i'),
])
->actions([
ViewAction::make()
->modalHeading('Text')
->infolist([
TextEntry::make('body')->markdown()->hiddenLabel(),
TextEntry::make('users_count')
->getStateUsing(fn ($record) => $record->users->count())
->label('N. Users that read at'),
RepeatableEntry::make('users')
->label('Readers')
->schema([
TextEntry::make('first_name')->hiddenLabel(),
TextEntry::make('last_name')->hiddenLabel(),
TextEntry::make('pivot.read_at')->date('d M Y - H:i')->hiddenLabel(),
])
->columns(3)
]),


]);
}

}
but how i can find the id of casting here Message::query()->where('casting_id', 22) ?
2 replies
FFilament
Created by ocram82 on 5/31/2024 in #❓┊help
FileUpload edit picsum.photos
No description
5 replies
FFilament
Created by ocram82 on 5/24/2024 in #❓┊help
ImageEntry relationship get url
hi, i've this:
Fieldset::make('Foto')
->relationship('photos')
->schema([
Infolists\Components\ImageEntry::make('name')
->url(fn ($record) => Storage::url($record->name), shouldOpenInNewTab: true)
->label('')->height(90)->width(90)->columnSpanFull(),
])->columns(5),
Fieldset::make('Foto')
->relationship('photos')
->schema([
Infolists\Components\ImageEntry::make('name')
->url(fn ($record) => Storage::url($record->name), shouldOpenInNewTab: true)
->label('')->height(90)->width(90)->columnSpanFull(),
])->columns(5),
but this ->url(fn ($record) => Storage::url($record->name), shouldOpenInNewTab: true) doesn't work....how can i retrieve the attribute name of the relationship photos? thanks
3 replies
FFilament
Created by ocram82 on 5/20/2024 in #❓┊help
ExportAction download file on Digital Ocean Spaces
hi all, as i mention in the title i've and export action like this:
->headerActions([
ExportAction::make()
->exporter(UserExporter::class)
->label('Export USers')
->icon('heroicon-o-document-text')
->color('primary'),
]);
->headerActions([
ExportAction::make()
->exporter(UserExporter::class)
->label('Export USers')
->icon('heroicon-o-document-text')
->color('primary'),
]);
If i set the FILAMENT_FILESYSTEM_DISK=local or not set it all it's ok: after i click export button i receive a notification in which i have the link to download the csv or xlsx and all that's fine. But if i set FILAMENT_FILESYSTEM_DISK=s3 all it's ok until i try to download the file. If i click on link to csv or xlsx i receive and error page like the image shows. the error is in :
Routing
Controller
Filament\Actions\Exports\Http\Controllers\DownloadExport

Route name
filament.exports.download

Middleware
filament.actions
Routing
Controller
Filament\Actions\Exports\Http\Controllers\DownloadExport

Route name
filament.exports.download

Middleware
filament.actions
What's wrong with this? Consider that i only want to download and not store those files. #help #Export download link
3 replies
FFilament
Created by ocram82 on 4/12/2024 in #❓┊help
Assign role after registration
hi all, It's possibile to assign role after the registration? i've a custom register:
class Register extends BaseRegister
{
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('company_name')
->label('Company Name')
->required()
->maxLength(255),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
]);
}

}
class Register extends BaseRegister
{
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('company_name')
->label('Company Name')
->required()
->maxLength(255),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
]);
}

}
i would perform a $user->assignRole('agency'); how can i do that? thanks
94 replies
FFilament
Created by ocram82 on 4/12/2024 in #❓┊help
Forbidden after registration
hi all, my App Panel look like this:
...
class AgencyPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('agency')
->path('agency')
->darkMode(false)
->login()
->registration(Register::class)
->passwordReset()
->profile()

...
...
class AgencyPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('agency')
->path('agency')
->darkMode(false)
->login()
->registration(Register::class)
->passwordReset()
->profile()

...
and inside model User i use MustVerifyEmail why after registration i obtain a 403 Forbidden page and even after i click on email verification ? thanks
14 replies
FFilament
Created by ocram82 on 4/10/2024 in #❓┊help
filters on same relationship
No description
6 replies
FFilament
Created by ocram82 on 4/8/2024 in #❓┊help
Export download link
Hi all, i've implemented the export functionality following this guide https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export#overview all works: the file after pressing export button are correctly stored into storage/app/public/filament_export/ inside a folder named by a progressive number. But now, how i can give the download link to a user? Do i have to create a resource to manage all the exports or any others idea? thanks
11 replies
FFilament
Created by ocram82 on 4/2/2024 in #❓┊help
Widget table custom query
Hi all, i've a widget that aims to show the latest casting like this:
class LatestCastings extends BaseWidget
{
protected static ?int $sort = 2;

protected int|string|array $columnSpan = 'full';
public function table(Table $table): Table
{
return $table
->heading('Recent Castings')
->query(
Casting::query()->where('user_id', auth()->id())->latest()->take(5)
)
->columns([
....
class LatestCastings extends BaseWidget
{
protected static ?int $sort = 2;

protected int|string|array $columnSpan = 'full';
public function table(Table $table): Table
{
return $table
->heading('Recent Castings')
->query(
Casting::query()->where('user_id', auth()->id())->latest()->take(5)
)
->columns([
....
but Casting::query()->where('user_id', auth()->id())->latest()->take(5) seems not work
3 replies
FFilament
Created by ocram82 on 12/16/2023 in #❓┊help
Custom form field inside resource
Hi, i want to insert custom field inside a resource and i'm following this: https://filamentphp.com/docs/3.x/forms/fields/custom#custom-field-classes. All was ok untill the moment to define my inputs a wire:model. I've an array of input and i don't know how to define wire:model. I also don't know with simple example:
<input wire:model="name" />
<input wire:model="name" />
How i can define or retrieve property name inside a resource?
15 replies
FFilament
Created by ocram82 on 11/27/2023 in #❓┊help
Wizard form get other input value field
hi! i've a wizard and in the last step i want to get the value of some input form field that is in the previous steps....how can i get those values?
4 replies
FFilament
Created by ocram82 on 11/27/2023 in #❓┊help
Teacher List with week day and hour
No description
24 replies
FFilament
Created by ocram82 on 9/15/2023 in #❓┊help
Email verification not sended
hi i'm using ->emailVerification() in the AppPanelProvider in this way:
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('app')
->path('app')
->login()
->registration()
->passwordReset()
->emailVerification()
->profile()
...
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('app')
->path('app')
->login()
->registration()
->passwordReset()
->emailVerification()
->profile()
...
But after the user registration no email was sended. I've correctly configure mailpit and it works with notifications or other stuff. What i missing?
13 replies
FFilament
Created by ocram82 on 9/13/2023 in #❓┊help
Admin Panel and App Panel access
I've created the default admin panel and another AppPanel as ->default() how can i control the access to the panels? I want to allow only admin user to access admin panel and other users to access AppPanel. what's the simplest way to do it?
13 replies
FFilament
Created by ocram82 on 9/13/2023 in #❓┊help
Registering user and verify email link
Hi all, i'm using built in Filament v3 registration. How can i send email with link to verify that account? I'm asking this because i try to use ->emailVerification() from https://filamentphp.com/docs/3.x/panels/users#authentication-features but in local i not receive (i'm using mailpit in local) nothing as aspected
2 replies
FFilament
Created by ocram82 on 9/12/2023 in #❓┊help
Table Title Header
How can i define the table title header in the table widget dashboard? thanks
4 replies
FFilament
Created by ocram82 on 9/12/2023 in #❓┊help
Enum TextColumn badge() with label, icon and color
I have this enum class
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;

enum SubstitutionStatusEnum: string implements HasColor, HasIcon, HasLabel
{
case Suspended = 'suspended';
case Accepted = 'accepted';
case Rejected = 'rejected';

public function getColor(): string | array | null
{
return match ($this) {
self::Suspended => 'primary',
self::Accepted => 'success',
self::Rejected => 'danger',
};
}

public function getIcon(): ?string
{
return match ($this) {
self::Suspended => 'heroicon-o-ellipsis-horizontal-circle',
self::Accepted => 'heroicon-o-check-circle',
self::Rejected => 'heroicon-o-x-circle',
};
}

public function getLabel(): ?string
{
return match ($this) {
self::Suspended => 'Suspended Acceptance',
self::Accepted => 'Accepted Acceptance',
self::Rejected => 'Rejected Acceptance',
};
}
}
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;

enum SubstitutionStatusEnum: string implements HasColor, HasIcon, HasLabel
{
case Suspended = 'suspended';
case Accepted = 'accepted';
case Rejected = 'rejected';

public function getColor(): string | array | null
{
return match ($this) {
self::Suspended => 'primary',
self::Accepted => 'success',
self::Rejected => 'danger',
};
}

public function getIcon(): ?string
{
return match ($this) {
self::Suspended => 'heroicon-o-ellipsis-horizontal-circle',
self::Accepted => 'heroicon-o-check-circle',
self::Rejected => 'heroicon-o-x-circle',
};
}

public function getLabel(): ?string
{
return match ($this) {
self::Suspended => 'Suspended Acceptance',
self::Accepted => 'Accepted Acceptance',
self::Rejected => 'Rejected Acceptance',
};
}
}
and in my Resurce i've
Tables\Columns\TextColumn::make('accepted_status')
->label('Status')
->badge()
->sortable(),
Tables\Columns\TextColumn::make('accepted_status')
->label('Status')
->badge()
->sortable(),
but i only see a badge right coloured with enum value (suspended, accepted, ecc...) but i can't see the icon and the label. How can i get the labels and the icon inside the badge? Thanks
8 replies