Erlich
Erlich
FFilament
Created by MZX on 9/27/2024 in #❓┊help
Observer causing update form to get stuck
I refactored your code with return early. Maybe you can find your problem more easily:
public function updated(StartRonde $startRonde): void
{
// Check if scans are empty
if (empty($startRonde->scans)) {
return;
}

// Count the number of references in scans
$scanCount = count($startRonde->scans);

// Fetch the associated ronde and its pointeaux
$ronde = $startRonde->ronde; // Assuming you have a relationship defined
$pointeauCount = $ronde->pointeaux()->count(); // Count the pointeaux

// Check if the counts are not equal
if ($scanCount !== $pointeauCount) {
Log::warning('Reference count does not match the number of Pointeaux for StartRonde ID: ' . $startRonde->id);
return;
}

// Logic when counts are equal
$startRonde->status = 'finished';
$startRonde->save(); // Save the changes to the database
}
public function updated(StartRonde $startRonde): void
{
// Check if scans are empty
if (empty($startRonde->scans)) {
return;
}

// Count the number of references in scans
$scanCount = count($startRonde->scans);

// Fetch the associated ronde and its pointeaux
$ronde = $startRonde->ronde; // Assuming you have a relationship defined
$pointeauCount = $ronde->pointeaux()->count(); // Count the pointeaux

// Check if the counts are not equal
if ($scanCount !== $pointeauCount) {
Log::warning('Reference count does not match the number of Pointeaux for StartRonde ID: ' . $startRonde->id);
return;
}

// Logic when counts are equal
$startRonde->status = 'finished';
$startRonde->save(); // Save the changes to the database
}
9 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
Okay. I did and I will keep this in my mind. Thank you
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
anything else should I do?
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
I put 👍 to you answer
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
Thanks to you
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
No description
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
No description
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
No description
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
Let me try.
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
How to use another relation's column as titleAttribute in Select
No description
20 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
I need to localize Relation Manager tab
No description
7 replies
FFilament
Created by Erlich on 9/27/2024 in #❓┊help
I need to localize Relation Manager tab
No description
7 replies
FFilament
Created by Erlich on 9/25/2024 in #❓┊help
I need to change DatePicker language
No description
7 replies
FFilament
Created by Erlich on 9/25/2024 in #❓┊help
I need to change DatePicker language
I will think about it. I cannot change google chrome language right now.
7 replies