zemo
zemo
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
though, I just did this and it appears to do what I'm trying to do. might stick with it at this point
->createOptionUsing(function (array $data) {
$subscription = Subscription::where('subject_id', $data['subject_id'])->where('subscription_year_id', $data['subscription_year_id'])->first();

if ($subscription) {
return;
}

$subscription = new Subscription();
$subscription->subject_id = $data['subject_id'];
$subscription->subscription_year_id = $data['subscription_year_id'];
$subscription->federation_id = $data['federation_id'];
$subscription->date = $data['date'];
$subscription->price = $data['price'];
$subscription->save();
return $subscription->id;
})
->createOptionUsing(function (array $data) {
$subscription = Subscription::where('subject_id', $data['subject_id'])->where('subscription_year_id', $data['subscription_year_id'])->first();

if ($subscription) {
return;
}

$subscription = new Subscription();
$subscription->subject_id = $data['subject_id'];
$subscription->subscription_year_id = $data['subscription_year_id'];
$subscription->federation_id = $data['federation_id'];
$subscription->date = $data['date'];
$subscription->price = $data['price'];
$subscription->save();
return $subscription->id;
})
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
$validator = Validator::make($data, [
Rule::unique('subscriptions')->where(function ($query) use($data) {
ray('prova');
return $query->where('subject_id', $data['subject_id'])
->where('subscription_year_id', $data['subscription_year_id']);
}),
]);
if ($validator->fails()) {
ray('ciao');
return null;
}
$validator = Validator::make($data, [
Rule::unique('subscriptions')->where(function ($query) use($data) {
ray('prova');
return $query->where('subject_id', $data['subject_id'])
->where('subscription_year_id', $data['subscription_year_id']);
}),
]);
if ($validator->fails()) {
ray('ciao');
return null;
}
even this was not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
like the one I was trying to do (which is commented)? in the createOptionUsing
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
so perhaps it does not know which table to check for the unique validation rule?
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
Forms\Components\Select::make('subscription_id') doesn't have a relationship()
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
ahhh maybe I found a logic reason as to why it is not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
cos if they fired I would've known that the issue had to do with the fn
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
the very strange thing is that the dd() or the ray() are not firing..
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
did both, not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
v3.2.96
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
I hope this is fine as well
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
goddamnit the message is too long lol
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
one sec
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
yes, thanks
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
neither the error_log() (I think, I've never used this but placing it in the callback fn before the return is doing nothing)
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
nothing, the dd is not fired at all
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
(same with TextInput)
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
error: Method Filament\Forms\Components\Select::fillForm does not exist.
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
what is this used for and where do I add it?
32 replies