Lucky0
Lucky0
FFilament
Created by arul on 7/2/2024 in #❓┊help
403 forbidden when production
14 replies
FFilament
Created by Lucky0 on 6/30/2024 in #❓┊help
Toggle with eager loading in form
Forms\Components\Group::make([
Forms\Components\Toggle::make('is_enabled')
->label('Enable Notifications')
->formatStateUsing(fn ($record) => $record->is_enabled),
])
->relationship('notificationPreference'),
Forms\Components\Group::make([
Forms\Components\Toggle::make('is_enabled')
->label('Enable Notifications')
->formatStateUsing(fn ($record) => $record->is_enabled),
])
->relationship('notificationPreference'),
5 replies
FFilament
Created by Lucky0 on 6/30/2024 in #❓┊help
Toggle with eager loading in form
Thank you, kind sire..
5 replies
FFilament
Created by Yatendra on 3/31/2024 in #❓┊help
login with email and username
still works!
6 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
i used this
composer require barryvdh/laravel-dompdf
composer require barryvdh/laravel-dompdf
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
this one work. i tried it
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
try this:
Tables\Actions\BulkAction::make('generatePdf')
->label('Generate PDF')
->action(function ($records) {
$pdf = Pdf::loadView('pdf.selected-items', ['records' => $records]);
return response()->streamDownload(function () use ($pdf) {
echo $pdf->output();
}, 'selected-items.pdf');
})
->deselectRecordsAfterCompletion(),
Tables\Actions\BulkAction::make('generatePdf')
->label('Generate PDF')
->action(function ($records) {
$pdf = Pdf::loadView('pdf.selected-items', ['records' => $records]);
return response()->streamDownload(function () use ($pdf) {
echo $pdf->output();
}, 'selected-items.pdf');
})
->deselectRecordsAfterCompletion(),
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selected Items</title>
<style>
/* Add any necessary styles here */
</style>
</head>

<body>
<h1>Selected Items</h1>
@foreach ($records as $record)
<h2>Item {{ $loop->iteration }}</h2>

<p>ID: {{ $record->id }}</p>
<p>Name: {{ $record->name }}</p>

@endforeach
</body>

</html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selected Items</title>
<style>
/* Add any necessary styles here */
</style>
</head>

<body>
<h1>Selected Items</h1>
@foreach ($records as $record)
<h2>Item {{ $loop->iteration }}</h2>

<p>ID: {{ $record->id }}</p>
<p>Name: {{ $record->name }}</p>

@endforeach
</body>

</html>
with this you dont have to use controller
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
can i see your catalogpdf code?
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
can you share you code here, please?
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
use this as reference: https://laraveldaily.com/post/laravel-dompdf-generate-simple-invoice-pdf-with-images-css all i can help is with the logic. hopefully.. what you want is to get list of that selected items. right? try to output it in a page see if its displaying all the items. then you use that page and convert it to pdf.. not sure if this will work.. havent tried it myself, but you never know, unless you try..
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
if you get the selected output then you can just convert them into one PDF
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
what output did you get when you do dd($outputSelected)?
64 replies
FFilament
Created by Vishal Thakkar on 6/27/2024 in #❓┊help
How to get selected records in PDF using filament 3
you having trouble converting data to PDF?
64 replies
FFilament
Created by Lucky0 on 6/7/2024 in #❓┊help
ManyToMany Relationship on AttachAction
I was ignoring the error. cause I was so sure that I named the function correctly.. Thank you. just literally change the carFeatures in Feature Model to 'carOwners' fixed it.
5 replies
FFilament
Created by Lucky0 on 6/7/2024 in #❓┊help
ManyToMany Relationship on AttachAction
up
5 replies
FFilament
Created by Lucky0 on 4/22/2024 in #❓┊help
External API CRUD in Filament
I see. thank you
10 replies
FFilament
Created by Lucky0 on 4/7/2024 in #❓┊help
deep relationship
I'm wondering if there are any better solution than this.
5 replies
FFilament
Created by Lucky0 on 4/7/2024 in #❓┊help
deep relationship
solved it
Tables\Columns\TextColumn::make('car_id')
->formatStateUsing(
function ($state, Car $car): string {
$query = $car->with('brand')->where('id', $state)->first();
return $query->brand->name . ' - ' . $query->name->name;
}
)
->sortable(),
Tables\Columns\TextColumn::make('car_id')
->formatStateUsing(
function ($state, Car $car): string {
$query = $car->with('brand')->where('id', $state)->first();
return $query->brand->name . ' - ' . $query->name->name;
}
)
->sortable(),
5 replies
FFilament
Created by Lucky0 on 4/1/2024 in #❓┊help
I can't select the first index. I've been banging my head for hours.
Forms\Components\Select::make('color_id')
->label('Color')
->options(
CarColor::all()->mapWithKeys(function ($color) {
return [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
];
})
)
->reactive()
Forms\Components\Select::make('color_id')
->label('Color')
->options(
CarColor::all()->mapWithKeys(function ($color) {
return [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
];
})
)
->reactive()
my solutions
5 replies
FFilament
Created by Lucky0 on 3/24/2024 in #❓┊help
UnitTest (bug)?
also i just do it like this. just adding condition to the inOrder. cause i figures that if one column is inOrder then the other is not, thus that what trigger the error.
test(
'can sort users ',
function ($column) {
$users = User::get();
livewire(UserResource\Pages\ListUsers::class)
->sortTable($column)
->assertCanSeeTableRecords($users->sortBy($column), inOrder: $column === 'name' ? true : false)
->sortTable($column, 'desc')
->assertCanSeeTableRecords($users->sortByDesc($column), inOrder: $column === 'name' ? true : false);
}
)->with(['name', 'email']);
test(
'can sort users ',
function ($column) {
$users = User::get();
livewire(UserResource\Pages\ListUsers::class)
->sortTable($column)
->assertCanSeeTableRecords($users->sortBy($column), inOrder: $column === 'name' ? true : false)
->sortTable($column, 'desc')
->assertCanSeeTableRecords($users->sortByDesc($column), inOrder: $column === 'name' ? true : false);
}
)->with(['name', 'email']);
43 replies