Skip to content

Instantly share code, notes, and snippets.

View LegitDongo's full-sized avatar

LegitDongo

View GitHub Profile
@LegitDongo
LegitDongo / !RequiredIfIn.php
Last active May 24, 2023 19:17
RequiredIfIn - Laravel validation rule requiring a field when a value exists in another field that is an array.
<?php
namespace App\Rules;
use App\Traits\Instantiate;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Contracts\Validation\DataAwareRule;
use Illuminate\Contracts\Validation\ValidatorAwareRule;
use InvalidArgumentException;