PHP code example of tbitencourt / laravel-repository-eloquent

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

    

tbitencourt / laravel-repository-eloquent example snippets


        'providers' => [
		// [...]
                Tbitencourt\LaravelRepositoryEloquent\Providers\RepositoryEloquentServiceProvider::class,
        ],

use Tbitencourt\LaravelRepositoryEloquent\RepositoryEloquent;

class UserRepository extends RepositoryEloquent {

    /**
     * Specify \Illuminate\Database\Eloquent\Model class name
     * @return string
     */
    public function model()
    {
        return User::class;
    }
}

    protected $repository;
    
    public __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }
    
    public index(Request $request)
    {
        $result = $this->repository->get();
        
        return view('myView');
    }

php artisan vendor:publish --provider="Tbitencourt\LaravelRepositoryEloquent\Providers\RepositoryEloquentServiceProvider"