Laravel validation rule 'Exists' with secret feature.
In this post, I wish to share one secret feature of laravel validation rule 'Exists'. If you have worked with laravel and familiar with laravel validation, you must know what does 'Exists' rule checks. If not let me give here a brief about this. In simple words, 'Exists' rule check if a record exists in the given database table with column value matching with the provided input value. Format: 'exists:table,column' So this is what as mentioned in laravel documentation too. So looking at the format we understand that this rule is to validate given input value by check if any records exist or not for that particular input value matching with the given column values of the table. Let's take an example. 'booking_id' => 'exists:bookings,id' Here we are validating provided booking_id with exists, if records exist in bookings table matching the column id (in most of the cases but can use any column as per your requirement.) ...