%PDF- %PDF-
Direktori : /var/www/html/news/vendor/guilhermegonzaga/presenter/src/ |
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)}; } }