raymondidema/presenter

Simple view presenters

2.0.0 2014-09-15 07:45 UTC

This package is not auto-updated.

Last update: 2024-12-21 17:38:13 UTC


README

Usage

Note: for Laravel 5 use ~2.* and for Laravel 4 use ~1.*

Presenters

    use Raymondidema\Presenter\Presenter;
    class UserPresenter extends Presenter {
        public function fullName()
        {
            return $this->first . ' ' . $this->last;
        }
    }

Models

    use Raymondidema\Presenter\PresentableTrait;

    class User extends \Eloquent {
        use PresentableTrait;
        protected $presenter = 'UserPresenter';
    }

How to use

    <h1>Hello, {{ $user->present()->fullName }}.</h1>