Example of Custom validation rules in SomeRandomGhUser/shekelcount

File app/Rules/BelongsToUserRule.php (link to Github)
use DB;
use Illuminate\Contracts\Validation\Rule;

class BelongsToUserRule implements Rule
{
    private $table;
    private $item_id;
    private $user_id;
    private $message;

    public function __construct($table, $item_id, $user_id, $message)
    {
        $this->table = $table;
        $this->item_id = $item_id;
        $this->user_id = $user_id;
        $this->message = $message;
    }

    public function passes($attribute, $value)
    {
        return DB::table($this->table)
            ->where(['id' => $this->item_id, 'user_id' => $this->user_id])
            ->exists();
    }

    public function message()
    {
        return $this->message;
    }
}
File app/Http/Requests/Categories/DeleteCategoryRequest.php (link to Github)
use App\Rules\BelongsToUserRule;
use Illuminate\Foundation\Http\FormRequest;

class DeleteCategoryRequest extends FormRequest
{
    public function rules()
    {
        return [
            'id' => [
                'required',
                'integer',
                'exists:categories',
                new BelongsToUserRule('categories', $this->id, auth()->id(), 'Эта категория не пренадлежит вам')
            ]
        ];
    }

    public function authorize()
    {
        return true;
    }
}

Additional resources on custom validation rules: