PHP code example of elegantmedia / laravel-simple-repository

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

    

elegantmedia / laravel-simple-repository example snippets

 php
php artisan make:repository Car

// this will create
app/Models/CarsRepository.php
 php
// overwrite existing file
php artisan make:repository Car --force

// change the default directory to `Entities`
php artisan make:repository Car --dir Entities
 php
// change default associated model
php artisan make:repository Car --model Vehicles\\SuperCar
 php 
php artisan make:repository Car --group
 
// command
php artisan make:repository Car --dir Entities --group

// file structure (Car.php is an example and created by this command)
app/Entities/Cars/CarsRepository.php
app/Entities/Cars/Car.php



namespace App\Models;

use ElegantMedia\SimpleRepository\SimpleBaseRepository as BaseRepository;

class UsersRepository extends BaseRepository
{

	// bind the model to the Repository
	public function __construct(User $model)
	{
		parent::__construct($model);
	}

}