Skip to content

pdphilip/laravel-data-set

Repository files navigation

Laravel Data Set

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

Eloquent style management of data sets in Laravel

Installation

Add the package via composer:

composer require pdphilip/laravel-data-set

Usage

use PDPhilip\DataSet\DataSet;

$dataSet = new DataSet;

//Add data models
$model = $dataSet->create();
$model->name = 'Alpha';
$model->status = 'active';
$model->hits = 2;
$model->save();

$model2 = $dataSet->create();
$model2->name = 'Bravo';
$model2->status = 'active';
$model2->hits = 15;
$model2->save();

$model3 = $dataSet->create();
$model3->name = 'Charlie';
$model3->status = 'inactive';
$model3->hits = 6;
$model3->save();

$model4 = $dataSet->create();
$model4->name = 'Delta';
$model4->status = 'active';
$model4->hits = 11;
$model4->save();

$dataSet->add([
$model4->name = 'Echo';
$model4->status = 'inactive';
$model4->hits = 5;
]);

//Find
$model = $dataSet->where('name','Charlie')->first()
$models = $dataSet->where('status','active')->get()
$models = $dataSet->where('hits','>',5)->get()
$models = $dataSet->search('Delta')->get()
///.....

//Count
$count = $dataSet->where('hits','>',5)->count() //3

Testing

composer test

Changelog

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

Credits

License

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

About

Eloquent style management of data sets in Laravel

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages