nowak
nowak
Explore posts from servers
FFilament
Created by nowak on 8/9/2024 in #❓┊help
Duplicate and missing records/rows when navigating table pages
I see this more as a workaround than a fix. Records should not be missing in tables and the same record should not be shown on multiple table pages in the first place
13 replies
FFilament
Created by nowak on 8/9/2024 in #❓┊help
Duplicate and missing records/rows when navigating table pages
@Leandro Ferreira I am not able to test this out and create a minimal repo on github any time soon, but if no one has made an issue on github about this before I have more time available, I will do it then.
13 replies
FFilament
Created by nowak on 8/9/2024 in #❓┊help
Duplicate and missing records/rows when navigating table pages
Wow. Good catch @martin-ro!
13 replies
FFilament
Created by nowak on 8/9/2024 in #❓┊help
Duplicate and missing records/rows when navigating table pages
I am not sure exactly how to reproduce it exactly yet, as I remember it being a bit random. @martin-ro is your use case easy to reproduce?
13 replies
FFilament
Created by nowak on 8/9/2024 in #❓┊help
Duplicate and missing records/rows when navigating table pages
No I did not, but please let me know if you find an answer for this
13 replies
NNuxt
Created by nowak on 12/11/2024 in #❓・help
Error when running a vanilla Nuxt UI V3 app
npx nuxi init -t ui3 <app> did it. No errors here
8 replies
NNuxt
Created by nowak on 12/11/2024 in #❓・help
Error when running a vanilla Nuxt UI V3 app
I just realised that npx nuxi init -t ui <app> does not install Nuxt UI v3, I willl try to install it with v3 first.
8 replies
FFilament
Created by nowak on 10/24/2024 in #❓┊help
How to add a CreateAction in the headerActions of resource A, to create a record in resource B?
After looking into this again, I thought that it was weird that the native CreateAction didn't work. So I tried to add this to the List page instead:
protected function getHeaderActions(): array
{
return [
CreateAction::make('userOrder')
->label('Create User Order')
->model(UserOrder::class)
->form(UserOrderResource::getFormSchema())
->fillForm([
'user_id' => User::firstWhere(
'email',
config('meinrad.assistant_email')
)->id
])
->mutateFormDataUsing(function (array $data): array {
$mealType = MealType::find($data['meal_type_id']);
$deliveryDate = Carbon::createFromFormat(
'Y-m-d',
$data['delivery_date']
);
$orderDeadlineTime = Carbon::createFromFormat(
'H:i:s',
$mealType->order_deadline
);
$deadline = $deliveryDate->setTime(
$orderDeadlineTime->hour,
$orderDeadlineTime->minute,
$orderDeadlineTime->second
);
$data['deadline'] = $deadline->toDateTimeString();
return $data;
})
->after(function ($record) {
$detailCreator = app(CreatesUserOrderDetails::class);
$detailCreator->create($record);
$groupOrderCreator = app(CreatesGroupOrders::class);
$groupOrder = $groupOrderCreator->create($record);
if ($groupOrder) {
$updater = app(UpdatesGroupOrders::class);
$updater->update($groupOrder, []);
}
}),
];
}
protected function getHeaderActions(): array
{
return [
CreateAction::make('userOrder')
->label('Create User Order')
->model(UserOrder::class)
->form(UserOrderResource::getFormSchema())
->fillForm([
'user_id' => User::firstWhere(
'email',
config('meinrad.assistant_email')
)->id
])
->mutateFormDataUsing(function (array $data): array {
$mealType = MealType::find($data['meal_type_id']);
$deliveryDate = Carbon::createFromFormat(
'Y-m-d',
$data['delivery_date']
);
$orderDeadlineTime = Carbon::createFromFormat(
'H:i:s',
$mealType->order_deadline
);
$deadline = $deliveryDate->setTime(
$orderDeadlineTime->hour,
$orderDeadlineTime->minute,
$orderDeadlineTime->second
);
$data['deadline'] = $deadline->toDateTimeString();
return $data;
})
->after(function ($record) {
$detailCreator = app(CreatesUserOrderDetails::class);
$detailCreator->create($record);
$groupOrderCreator = app(CreatesGroupOrders::class);
$groupOrder = $groupOrderCreator->create($record);
if ($groupOrder) {
$updater = app(UpdatesGroupOrders::class);
$updater->update($groupOrder, []);
}
}),
];
}
Which works, but I have to add mutateFormDataUsing and after logic, as this is not inherited from the UserOrderResource Create page. So this action would be added to the page header instead of the table header, which is also a con, but CreateAction() just doesn't work from a tables headerActions([]) for some good reason probably. @ChesterS Maybe useful for you as well?
23 replies
FFilament
Created by ericmp on 10/25/2024 in #❓┊help
Sort table by random order
example:
15 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I had to use this as well I think:
php artisan filament:optimize-clear
php artisan filament:optimize-clear
Are you saying this wasn't necessary?
25 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
Should this be ran on every deploy?
25 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
Yes! I found this:
'app.filament.pages.dashboard' => 'App\\Filament\\Pages\\Dashboard',
'app.filament.pages.dashboard' => 'App\\Filament\\Pages\\Dashboard',
in /bootstrap/cache/filament/panels/admin.php What is the recommended way of clearing this cache?
25 replies
FFilament
Created by ericmp on 10/25/2024 in #❓┊help
Sort table by random order
Okay, I got curious so I added a 2000 song table to a fresh filament installation and did some experimenting. got it to work by using baseQuery instead of query (https://filamentphp.com/docs/3.x/tables/filters/getting-started#modifying-the-base-query) :
->filters([
Filter::make('Shuffle')
->toggle()
->baseQuery(fn (Builder $query) => $query->inRandomOrder())
->label('Shuffle Songs'),
])
->filters([
Filter::make('Shuffle')
->toggle()
->baseQuery(fn (Builder $query) => $query->inRandomOrder())
->label('Shuffle Songs'),
])
15 replies
FFilament
Created by ericmp on 10/25/2024 in #❓┊help
Sort table by random order
Are you showing thousands of songs at once? You could just shuffle the songs shown in the current view. I don't know how expensive it would be to shuffle all songs in the database, might be worth trying out, though
15 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
Still weird that I have no issues on my local environment, only on my remote server do I get this error.
25 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I removed KitchenDashboard from my admin panel provider pages as this wasn't necessary on a fresh filament installation, and changed to:
use HasFiltersForm;
use HasFiltersForm;
I get the same ish error still:
include(/home/www/appstaging.meinrad.ch/app/Filament/Pages/Dashboard.php): Failed to open stream: No such file or directory
include(/home/www/appstaging.meinrad.ch/app/Filament/Pages/Dashboard.php): Failed to open stream: No such file or directory
Here is my flare error: https://flareapp.io/share/bP9oYg85
25 replies
FFilament
Created by ericmp on 10/25/2024 in #❓┊help
Sort table by random order
This is basically what the filament reorder functionality does, but one by one.
15 replies
FFilament
Created by ericmp on 10/25/2024 in #❓┊help
Sort table by random order
I think what you need to do, is to add a sorting column to your songs table, that you can use to: 1. Sort the records by in the table 2. Use a custom table header action to "randomly" shuffle the sort integers of your song records Then when you trigger your "Randomize" action, the sort would be shuffled, and your song records would appear to be shuffled as well as a result.
15 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I did this:
<?php

namespace App\Filament\Pages;

use App\Models\MealType;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use App\Filament\Widgets;

class KitchenDashboard extends BaseDashboard
{

use BaseDashboard\Concerns\HasFiltersForm;

protected static ?string $title = 'Kitchen Dashboard';
protected static ?string $navigationIcon = 'icon-chef-hat';
protected static string $routePath = 'kitchen';
.......
<?php

namespace App\Filament\Pages;

use App\Models\MealType;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use App\Filament\Widgets;

class KitchenDashboard extends BaseDashboard
{

use BaseDashboard\Concerns\HasFiltersForm;

protected static ?string $title = 'Kitchen Dashboard';
protected static ?string $navigationIcon = 'icon-chef-hat';
protected static string $routePath = 'kitchen';
.......
25 replies
FFilament
Created by nowak on 10/14/2024 in #❓┊help
I get Class "App\Filament\Pages\Dashboard" not found after removing Dashboard on Production
I do have this route in my routes/web.php file:
Route::get('/dashboard', function () {
return redirect()->route('home');
})->name('dashboard');
Route::get('/dashboard', function () {
return redirect()->route('home');
})->name('dashboard');
Which I use for my inertia frontend. Maybe this has something to do with it?
25 replies