1. Go to this page and download the library: Download madulinux/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/ */
madulinux / repository example snippets
namespace App\Repositories\Eloquent;
use App\Models\User;
use Madulinux\Repositories\Eloquent\BaseRepository as Repository;
use App\Repositories\UserRepositoryInterface;
/**
* Class UserRepository
* @package App\Repositories\Eloquent
*/
class UserRepository extends Repository implements UserRepositoryInterface
{
/**
* @return string
*/
public function model()
{
return User::class;
}
}
namespace App\Repositories;
use Madulinux\Repositories\BaseRepositoryInterface as Repository;
/**
* Class UserRepositoryInterface
* @package App\Repositories
*/
interface UserRepositoryInterface extends Repository
{
//
}
namespace App\Repositories\Criteria\Profiles;
use Madulinux\Repositories\Criteria\Criteria;
use Madulinux\Repositories\BaseRepositoryInterface as Repository;
/**
* Class SeventeenYearsOld
*
* @package App\Repositories\Criteria\Profiles
*/
class SeventeenYearsOld extends Criteria {
/**
* @param $model
* @param Repository $repository
*
* @return mixed
*/
public function apply($model, Repository $repository)
{
return $model;
}
}