PHP code example of nalingia / laravel-repositories

1. Go to this page and download the library: Download nalingia/laravel-repositories library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nalingia / laravel-repositories example snippets


'providers' => [
  ...
  Nalingia\Repositories\RepositoriesServiceProvider::class,
  ...
]

public function all(array $with = []); 

public function findById($id, array $with = [], $fail = true);

public function getFirstBy($key, $value, array $with = [], $comparator = '=', $fail = false);

public function getManyBy($key, $value, array $with = [], $comparator = '=');

public function getFirstWhere(array $where, $with = [], $fail = false);

public function getAllWhere($where, $with = [], $columns = ['*']);

public function getByPage($page = 1, $limit = 10, array $with = []);

public function create(array $data);

public function update($model, array $data);

public function delete($model);

public function truncate();

public function getAllWhereColumnNameIn(array $needles, array $with = []);

php artisan vendor:publish --provider="Nalingia\Repositories\RepositoriesServiceProvider"

composer test

vendor/bin/phpunit
bash
php artisan make:repository User