Working with plain old php today (not laravel) :)
Trying to fix a weird bug. I have written my own queue handler, but if I let supervisor start 2 or more processes, they all pick the same job off the jobs table.. The query is inside a transaction. It runs a select to find the next job, and then sets the reserved column to a timestamp..
I even tried adding FOR UPDATE to the select query, but that seems to never release the lock for some reason.. I cannot close the queue command normally, and if I run "SHOW FULL PROCESSLIST" I can see the update query in the list forever..
Any pdo/sql/php geniuses around that might have any idea on how to fix this!? :D
I managed to fix it. The job changed some stuff in the dependency injection container, which was never rolled back.. So I added a call to reset the DIC on every run :D
Thanks for all your help!
I am concidering using filamentphp to write a management system for projects. Does anyone know of a plugin to make this easy? My plan is to pick a project when you sign in and then the whole navigation etc is for that project.
Maybe I need to write my own, but if it's already possible out of the box that could save me a lot of time
A small trick. I wanted to use my DOM assertions package to test a livewire form today. It has an `->assertFormExists()` method. Now the problem arose as I am using filament in the same project. Filament has a method by the same name, registered as a macro on the livewire testable. So their method would always be called.
So to get around this I simply added a small macro wrapper in Pest.php
TestResponse::macro('assertFormElementExists', function (...$params) {
return $this->assertFormExists(...$params);
});
I was then able to call the new method on my livewire component
Livewire::test(Access::class, ['access' => $this->access])
->assertFormElementExists('form', function (AssertForm $form) {
$form->hasCSRF();
$form->has('wire:submit.prevent');
});
When I have nested parameters in an url using route model binding, laravel will automatically populate the pivot on the child model. This even works on belongToMany relationships, with a custom pivot model. Sadly this breaks in livewire when rehydrating the child model.
Does anyone have a clever trick to hydrate the pivot again ?
I ended up adding ulids to my pivot table and using that in the urls instead. That way it is waay simpler and I can load the file relationsship from there :)
TIL. There is a spoof checker class built into php, for checking if a string contains spoofed characters!
www.php.net/manual/en/class.spoofchecker.php