ocram82
ocram82
FFilament
Created by ocram82 on 10/1/2024 in #❓┊help
Wizard Get $get select multiple value based on filed
I've a form wizard like this:
public static function form(Form $form): Form
{
return $form
->schema([
...
Wizard\Step::make('Company')
->schema([
Forms\Components\Select::make('companies')
->relationship('companies', 'name')
->label('Select companies')
->options(Company::orderBy('name')->pluck('name', 'id')->toArray())
->multiple()
->searchable(['name'])
->live()
->required(),
Forms\Components\Select::make('owner_id')
->label('Select Lead company')
->options(function (Get $get) {

$companyIds = $get('companies');

if (empty($companyIds)) {
return Company::pluck('name', 'id')->toArray();
}

return Company::whereIn('id', $companyIds)
->pluck('name', 'id')
->toArray();
})->required(),
]),
...
public static function form(Form $form): Form
{
return $form
->schema([
...
Wizard\Step::make('Company')
->schema([
Forms\Components\Select::make('companies')
->relationship('companies', 'name')
->label('Select companies')
->options(Company::orderBy('name')->pluck('name', 'id')->toArray())
->multiple()
->searchable(['name'])
->live()
->required(),
Forms\Components\Select::make('owner_id')
->label('Select Lead company')
->options(function (Get $get) {

$companyIds = $get('companies');

if (empty($companyIds)) {
return Company::pluck('name', 'id')->toArray();
}

return Company::whereIn('id', $companyIds)
->pluck('name', 'id')
->toArray();
})->required(),
]),
...
4 replies
FFilament
Created by ocram82 on 9/20/2024 in #❓┊help
Disable view action when click on row
Hi, how can i disable click on row and open view modal? I only want open modal when i click on View button and not when i click on the row. thanks
11 replies
FFilament
Created by ocram82 on 9/18/2024 in #❓┊help
Database notification error Broadcasting [database-notifications.sent] on channels
Hi, every time i dispatch a job that has this code:
$agency = User::findOrFail($this->userId);

$agency->notify(
Notification::make()
->success()
->title('PDF created!')
->body('<a href="'.Storage::url($filename).'" target="_blank" style="text-decoration: none; font-weight:bold; color: green">Download .pdf</a>')
->toDatabase(),
);
$agency = User::findOrFail($this->userId);

$agency->notify(
Notification::make()
->success()
->title('PDF created!')
->body('<a href="'.Storage::url($filename).'" target="_blank" style="text-decoration: none; font-weight:bold; color: green">Download .pdf</a>')
->toDatabase(),
);
I obtain a 500 error in log file like this:
[2024-09-18 14:33:41] production.INFO: Broadcasting [database-notifications.sent] on channels [private-App.Models.User.3] with payload:
{
"user": {
"id": 3,
"profile_img_id": null,
"first_name": "John",
"last_name": "Doe",
"rag_sociale": "JohnDoe SRL",
"email": "[email protected]",
"email_verified_at": "2024-08-07 12:53:40",
"is_active": "2024-08-08 20:00:01",
"privacy_accepted_at": "2024-08-07 19:33:29",
"casting_country": null,
"phone_prefix": 39,
"phone": 12345678,
"nationality": null,
"birth_city": null,
"birth_date": null,
"fiscal_code": null,
"created_at": "2024-08-07 12:53:08",
"updated_at": "2024-08-08 20:00:01"
},
"socket": null
}
[2024-09-18 14:33:41] production.INFO: Broadcasting [database-notifications.sent] on channels [private-App.Models.User.3] with payload:
{
"user": {
"id": 3,
"profile_img_id": null,
"first_name": "John",
"last_name": "Doe",
"rag_sociale": "JohnDoe SRL",
"email": "[email protected]",
"email_verified_at": "2024-08-07 12:53:40",
"is_active": "2024-08-08 20:00:01",
"privacy_accepted_at": "2024-08-07 19:33:29",
"casting_country": null,
"phone_prefix": 39,
"phone": 12345678,
"nationality": null,
"birth_city": null,
"birth_date": null,
"fiscal_code": null,
"created_at": "2024-08-07 12:53:08",
"updated_at": "2024-08-08 20:00:01"
},
"socket": null
}
In the panel provider i've this:
...
->databaseNotifications()
->databaseNotificationsPolling('15s')
...
...
->databaseNotifications()
->databaseNotificationsPolling('15s')
...
and in the .env the variabile QUEUE_CONNECTION=redis what's wrong on this?
3 replies
FFilament
Created by ocram82 on 9/9/2024 in #❓┊help
Long text table
I've a table and i have a field that contains a long text. Is it possibile to add something like a "sub row" that columspan all the column for a row? Any solutions? thanks
7 replies
FFilament
Created by ocram82 on 8/7/2024 in #❓┊help
auth()->user() is null after login
Simply this....auth()->user() is null after login. Why?
12 replies
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