1. Go to this page and download the library: Download pacerit/laravel-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/ */
class ExampleRepository extends CoreRepository implements ExampleRepositoryInterface
{
/**
* Model entity class that will be use in repository
*
* @return CoreRepositoryInterface
* @author Wiktor Pacer <[email protected]>
* @since 2019-07-05
*/
public function entity(): string
{
return Example::class;
}
}
class ExampleController extends Controller {
/**
* @var ExampleRepositoryInterface $exampleRepository
*/
protected $exampleRepository;
public function __construct(ExampleRepositorynterface $exampleRepository){
$this->exampleRepository = $exampleRepository;
}
....
}
class ExampleRepository extends CoreRepository implements ExampleRepositoryInterface
{
use WithCache;
/**
* ExampleRepository constructor.
*
* @param Container $app
* @throws RepositoryEntityException
* @throws BindingResolutionException
*/
public function __construct(Container $app)
{
parent::__construct($app);
$this->skipUserTag();
}
}