seguce92 / laravel-repos by seguce92

Simple repository and Controller package for Laravel 5.
139
0
2
Package Data
Maintainer Username: seguce92
Maintainer Contact: seguce92@gmail.com (Sergio Gualberto Cruz Espinoza)
Package Create Date: 2017-05-03
Package Last Update: 2019-06-25
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:22:37
Package Statistics
Total Downloads: 139
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Installation

Install LaravelRepos as you would with any other dependency managed by Composer:

$ composer require seguce92/laravel-repos

Configuration

After installing repo all you need is to register the Seguce92\LaravelRepos\ServiceProvider in your config/app.php configuration file:

'providers' => [
    // Other service providers...

    Seguce92\LaravelRepos\ServiceProvider::class,
],

Creating a repository class

Use the seguce92:repos command to create your repository classes. This command will take as argument the repository class namesapce (from App) and a --model option which allows you to specify the full namespace of the Eloquent model to which the repository will be tied.

$ php artisan seguce92:repos "Repositories\FooRepository" --class="Foo" --model="App\Models\Foo"

OR

$ php artisan seguce92:repos "Repositories\FooRepository" -c "Foo" -m "App\Models\Foo"

The above command will generate the following repository class in the app/Repositories directory:

--hashid This option use if used hashid

Creating a controller class

Use the seguce92:cont command to create your repository classes. This command will take as argument the repository class namesapce (from App) and a --model option which allows you to specify the full namespace of the Eloquent model to which the repository will be tied.

$ php artisan seguce92:cont "Http\Controllers\FooController" --repository="App\Repositories\FooRepository" --model="foo"

OR

$ php artisan seguce92:cont "Http\Controllers\FooController" -r "App\Repositories\FooRepository" -m "foo"

The above command will generate the following repository class in the app/Http/Controllers directory: