Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

validation not exists with this id laravel

$e = Subscription::find($request->subscription_id);
$rules = [
  'subscription_id' => 'required|integer|exists:subscriptions,id',
  'date' => 'required|date|after:yesterday',
  'date' => Rule::unique('member_attendances')->where(function ($query) use ($e) {
              return $query->where('member_id', $e->member_id);
})
//|unique:member_attendances,date,'.$e->member_id . ',member_id',
];
 
PREVIOUS NEXT
Tagged: #validation #exists #id #laravel
ADD COMMENT
Topic
Name
3+9 =