%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/news/vendor/guilhermegonzaga/presenter/src/
Upload File :
Create Path :
Current File : /var/www/html/news/vendor/guilhermegonzaga/presenter/src/Presenter.php

<?php

namespace Laracodes\Presenter;

use Illuminate\Database\Eloquent\Model;

abstract class Presenter
{
    /**
     * @var \Illuminate\Database\Eloquent\Model
     */
    protected $model;

    /**
     * @param \Illuminate\Database\Eloquent\Model $model
     */
    public function __construct(Model $model)
    {
        $this->model = $model;
    }

    /**
     * @param $property
     * @return bool
     */
    public function __isset($property)
    {
        return method_exists($this, camel_case($property));
    }

    /**
     * @param $property
     * @return mixed
     */
    public function __get($property)
    {
        $camel_property = camel_case($property);

        if (method_exists($this, $camel_property)) {
            return $this->{$camel_property}();
        }

        return $this->model->{snake_case($property)};
    }
}

Zerion Mini Shell 1.0