deadbeef
deadbeef
FFilament
Created by deadbeef on 5/30/2024 in #❓┊help
Is there a way to hook an alpine event when a table loads new results?
Got it, feels a bit hackish but it works. Thank you guys!
Livewire.hook('commit', ({ component, commit, respond, succeed, fail }) => {
// Runs immediately before a commit's payload is sent to the server...

respond(() => {
// Runs after a response is received but before it's processed...
})

succeed(({ snapshot, effect }) => {
if(snapshot.includes('\"actionSubmitText\":\"Submit\"')) { // adjust snapshot check to your needs
// do whatever you need here
}
})

fail(() => {
// Runs if some part of the request failed...
})
})
Livewire.hook('commit', ({ component, commit, respond, succeed, fail }) => {
// Runs immediately before a commit's payload is sent to the server...

respond(() => {
// Runs after a response is received but before it's processed...
})

succeed(({ snapshot, effect }) => {
if(snapshot.includes('\"actionSubmitText\":\"Submit\"')) { // adjust snapshot check to your needs
// do whatever you need here
}
})

fail(() => {
// Runs if some part of the request failed...
})
})
8 replies
FFilament
Created by deadbeef on 5/30/2024 in #❓┊help
Is there a way to hook an alpine event when a table loads new results?
Thank you guys! I’ll give this a try shortly
8 replies
FFilament
Created by deadbeef on 5/30/2024 in #❓┊help
Is there a way to hook an alpine event when a table loads new results?
Sorry, I’m new to the livewire space - prior all Vue/API work. How do I find the name of that event?
8 replies
FFilament
Created by deadbeef on 3/18/2024 in #❓┊help
Match one of X validation rules on field
Thanks, for others - ended up with the following:
->rules([
'required',
fn() => function (string $attribute, $value, Closure $fail) {
$validIp = filter_var($value, FILTER_VALIDATE_IP) !== false;
if ($validIp) {
return;
}
$validUrl = filter_var($value, FILTER_VALIDATE_DOMAIN) !== false;
if (!$validIp && !$validUrl) {
$fail('The :attribute must be a valid IP address or domain.');
}
$validDns = checkdnsrr($value) !== false;
if (!$validDns) {
$fail('DNS lookup failed for the provided domain name.');
}
}
])
->rules([
'required',
fn() => function (string $attribute, $value, Closure $fail) {
$validIp = filter_var($value, FILTER_VALIDATE_IP) !== false;
if ($validIp) {
return;
}
$validUrl = filter_var($value, FILTER_VALIDATE_DOMAIN) !== false;
if (!$validIp && !$validUrl) {
$fail('The :attribute must be a valid IP address or domain.');
}
$validDns = checkdnsrr($value) !== false;
if (!$validDns) {
$fail('DNS lookup failed for the provided domain name.');
}
}
])
4 replies
FFilament
Created by deadbeef on 2/27/2024 in #❓┊help
Is there a way to pass a query builder into searchable select to populate options?
Thank you!
8 replies
FFilament
Created by deadbeef on 2/27/2024 in #❓┊help
Is there a way to pass a query builder into searchable select to populate options?
That works for small data sets, but what if you don't want to return all of the available data to the browser? Instead, I'm looking to have the user to filter the select down by a search driven via an eloquent query.
8 replies