2017 © Pedro Peláez
 

library eloquent-presenter

Model Presenters for Laravel

image

a2design/eloquent-presenter

Model Presenters for Laravel

  • Monday, November 21, 2016
  • by rabbiabram
  • Repository
  • 4 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Eloquent Presenter

Installation

Require this package, with Composer, in the root directory of your project., (*1)

``` bash $ composer require faustbrian/eloquent-presenter, (*2)


## Usage ### Presenter ``` php use BrianFaust\Presenter\BasePresenter; class CommentPresenter extends BasePresenter { public function getRoutePrefix() { return 'users.posts.comments'; } public function getRouteParameters() { // The ID of the model will be automatically attached to this array at the end // [ // $model->post->user->id, // $model->post->id, // $model->id // "id" is what is specified in $this->getRouteKeyName() // ]; return ['post.user.id', 'post.id']; } }

Model

use BrianFaust\Presenter\HasViewPresenterTrait;
use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    use HasViewPresenterTrait;

    /**
     * Get the view presenter for the model.
     *
     * @return string
     */
    protected function getPresenter()
    {
        return UserPresenter::class;
    }
}

Security

If you discover a security vulnerability within this package, please send an e-mail to Brian Faust at hello@brianfaust.de. All security vulnerabilities will be promptly addressed., (*3)

License

The The MIT License (MIT). Please check the LICENSE file for more details., (*4)

The Versions

21/11 2016

dev-master

9999999-dev

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

21/11 2016

2.1.0

2.1.0.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

15/11 2016

2.0.4

2.0.4.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

09/11 2016

2.0.3

2.0.3.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

09/11 2016

2.0.2

2.0.2.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

09/11 2016

2.0.1

2.0.1.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

08/11 2016

2.0.0

2.0.0.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter

04/11 2016

1.0.0

1.0.0.0

Model Presenters for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework eloquent-presenter brian faust faustbrian eloquent presenter