PHP code example of deseco / repository

1. Go to this page and download the library: Download deseco/repository 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/ */

    

deseco / repository example snippets


$providers = [
    ....
   
    Deseco\Repositories\RepositoriesServiceProvider::class,
]; 



namespace App\Repositories;

use Deseco\Repositories\Eloquent\Repository;

class ClientsRepository extends Repository
{
    /**
     * @return mixed
     */
    public function model()
    {
        // return Model::class;
    }
}



namespace App\Repositories;

use Deseco\Repositories\Factories\RepositoryFactory;

/**
 * Class Repositories
 */
class Repositories extends RepositoryFactory
{
    /**
	 * @var ClientsRepository
	 */
	public $clients = 'clients';
}


Route::get('/', function (\App\Repositories\Repositories $repo) {
    return $repo->clients->all();
});

public function index(ClientsRepository $clientsRepository)
{
    $clients = $clientsRepository->all();
}
sh
php artisan vendor:publish  --provider="Deseco\Repositories\RepositoriesServiceProvider"
sh
php artisan repository:make