marwelln/exists

Run exists queries in Laravel
31
Install
composer require marwelln/exists
Latest Version:v1.0.5
PHP:>=7.0
Laravel:5 – 8
License:MIT
Last Updated:Sep 19, 2020
Links: GitHub  ·  Packagist
Maintainer: Marwelln

Installation

composer require marwelln/exists:~1.0

Usage

$exists = Marwelln\Exists::table('mytable')->where('statement', 'value')->check(); // true or false

$exists = (new Marwelln\Exists('mytable'))->where('statement', 'value')->check(); // true or false

Available methods

static table(string $table)

Sets the table we want to run EXISTS with. Can use constructor instead if wanted.

where(string $key, mixed $value, string $operator = '=') // WHERE key {$operator} value

whereBetween(string $key, string $field1, string $field2) // WHERE key BETWEEN field1 AND field2

whereNull(string $key) // WHERE key IS NULL

whereNotNull(string $key) // WHERE key IS NOT NULL

Add WHERE statements. This can be chained.

check()
// SELECT EXISTS(SELECT 1 FROM table WHERE statements) AS `exists`

Run the query. Will return true or false depending on if the row existed or not.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v1.0.5 >=7.0 >=5.0 MIT
v1.0.4 >=7.0 ^5.0 MIT
v1.0.3 >=7.0 ~5.0|~6.0|~7.0 MIT
v1.0.2 >=7.0 ~5.0|~6.0 MIT
v1.0.1 >=7.0 ~5.0 MIT