LaravelPackages.net
Acme Inc.
Toggle sidebar
wahlemedia/laravel-where-in-array

A small package to check if an value of an array is containted within a given array.

3
0
1.0.0
About wahlemedia/laravel-where-in-array

wahlemedia/laravel-where-in-array is a Laravel package for a small package to check if an value of an array is containted within a given array.. It currently has 0 GitHub stars and 3 downloads on Packagist (latest version 1.0.0). Install it with composer require wahlemedia/laravel-where-in-array. Discover more Laravel packages by wahlemedia or browse all Laravel packages to compare alternatives.

Last updated

A small package to verify if an value in an array is containted within a given array.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds two helper functions to the builder to search multible values within an string or an array.

Installation

You can install the package via composer:

composer require wahlemedia/laravel-where-in-array

Usage

In your Model you need to have an json object to store an array within

// Your Model Migration
Schema::create('your_model', function (Blueprint $table) {
    //...
    $table->json('some_attribute')->nullable();
    //...
});

If you are working with array, you should cast the field of your model

    protected $casts = [
        'some_attribute' => 'array',
    ];

The function you can use by calling the following methods

Model::whereInArray('some_attribute', ['php', 'vue']) // or
Model::whereNotInArray('some_attribute', ['foo'])

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Star History Chart