master

laravel/framework

Last updated at: 29/12/2023 09:25

PresenceVerifierInterface.php

TLDR

This file provides the interface PresenceVerifierInterface for verifying the presence of objects in a collection.

Methods

getCount

Count the number of objects in a collection having the given value.

  • Parameters:
    • $collection - the name of the collection
    • $column - the column to check for the given value
    • $value - the value to search for in the collection
    • $excludeId (optional) - the ID to exclude from the count
    • $idColumn (optional) - the column that holds the ID
    • $extra (optional) - extra parameters to include in the count query
  • Return value: the number of objects in the collection having the given value

getMultiCount

Count the number of objects in a collection with the given values.

  • Parameters:
    • $collection - the name of the collection
    • $column - the column to check for the given values
    • $values - an array of values to search for in the collection
    • $extra (optional) - extra parameters to include in the count query
  • Return value: the number of objects in the collection with the given values
<?php

namespace Illuminate\Validation;

interface PresenceVerifierInterface
{
    /**
     * Count the number of objects in a collection having the given value.
     *
     * @param  string  $collection
     * @param  string  $column
     * @param  string  $value
     * @param  int|null  $excludeId
     * @param  string|null  $idColumn
     * @param  array  $extra
     * @return int
     */
    public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []);

    /**
     * Count the number of objects in a collection with the given values.
     *
     * @param  string  $collection
     * @param  string  $column
     * @param  array  $values
     * @param  array  $extra
     * @return int
     */
    public function getMultiCount($collection, $column, array $values, array $extra = []);
}