All Questions
92
questions
0
votes
1
answer
186
views
How can I use whereHas() method in Rule::unique() for Multi Column Unique Validation
Can I use whereHas method in Rule::unique() ?
There are no column here for cows, the data of cows are comming from pivot table by ManyToMany relationship.
Please help me.
I want something like that:
...
1
vote
0
answers
175
views
convert laravel 9 custom Rule to laravel 10 Rule
i have a custom Rule in laravel 9 and it has passes and message function like this:
<?php
namespace Auth\Http\Rules;
use Illuminate\Contracts\Validation\Rule;
class CustomRule implements Rule
{
...
0
votes
0
answers
58
views
Laravel Rule exists don't work with array
This is my validation rule, but with an invalid data they allow pass.
'curso_inteligencia_id' => [
'nullable',
'array', ...
0
votes
0
answers
153
views
Nested array validation rules not working on update in laravel
I have an array like this
"fio" => "John Dou"
"city" => "1"
"birthday" => "2022-10-21"
"email" => "test@...
1
vote
0
answers
141
views
Laravel exists validation: Should not pass when user and product are already stored
I have a product_votes table which stores for each user and product a value. The value can either be 1 or -1 which is equal to an upvote or downvote. A user can only either up- or downvote a product ...
1
vote
1
answer
943
views
laravel validation, Rule::exists or Rule::in
I want to validate sequence of items. In my idea sequence field must be exists in database sequence column or must be one plus more than maximum of present sequence.
I have this code in view:
<...
0
votes
0
answers
752
views
Implementing a rule engine in laravel
I am trying to build a rule engine for a medical app, this is the user interface i build
where on satisfying the conditions, it will send the action to the account specified like an alert or email.
...
1
vote
2
answers
175
views
How to check the being unique of the model without sending the model to the update method in laravel?
Email and username are unique to the user.in validating the user update request،for email and user name I have this error:
"message": "Attempt to read property "id" on string&...
0
votes
1
answer
928
views
Laravel: Feature test json validations unique rule issue
I recently started implementing the unit testing in Laravel 9.x framework. So far, I was able to write some basic rules without any complications. However, in my application I am validating the forms ...
1
vote
1
answer
1k
views
Laravel unique validation for combined multiple fields by custom logic
I am currently using Laravel 9 for my project.
Here is my validation rules
public function rules()
{
$parent_id = $this->parent_id != 0 ? $this->parent_id : null;
return [
'name'...
0
votes
2
answers
407
views
How to set a dynamic length in laravel-nova?
I am using Nova in laravel for designing the page,i am writing some rules function which will allows digits:20 .
Text::make('TrackID','id')->rules('nullable','digits:20' )->sortable()->...
0
votes
1
answer
480
views
Laravel validation Form - Don't accept number into double quotes
I have this POST request:
{
"documentType": "1",
"metadata": []
}
And i have this validation rules:
const POST_RULES = [
'documentType' => 'required|int',
...
0
votes
1
answer
691
views
laravel 8: validation unique multiple tables
I have a situation where I need to validate an identification number in two different tables (companies and units).
The company can register the units it owns, but the system cannot allow the ...
0
votes
1
answer
317
views
Laravel custom rule if previous rules passed
In Request rules() I have
public function rules()
{
return [
'files' => ['nullable', 'array'],
'files.*' => ['file','max:256000', new PostFiles],
'body' => '...
0
votes
1
answer
1k
views
Laravel validation if both field are empty then error . But if one is null then other is required
I am trying to make a rule if one is empty or not present then other is required but if both are not present then it give error.
I have used this but if both are empty then it not give any error
'...