mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 11:43:47 -08:00
61543f3a04
* Add presenters for models. Move bootstrap table JSON generation to these presenters, which cleans up controllers a lot. Move view specific modifications from the models to the presenters as well. * Fix some issues found by travis and codacy * Fix a few more issues found while testing. * Attempt another acceptance test fix * Try something else * Maybe..
38 lines
621 B
PHP
38 lines
621 B
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
use App\Models\SnipeModel;
|
|
|
|
abstract class Presenter
|
|
{
|
|
/**
|
|
* @var SnipeModel
|
|
*/
|
|
protected $model;
|
|
|
|
/**
|
|
* Presenter constructor.
|
|
* @param SnipeModel $model
|
|
*/
|
|
public function __construct(SnipeModel $model)
|
|
{
|
|
$this->model = $model;
|
|
}
|
|
|
|
public function __get($property)
|
|
{
|
|
if( method_exists($this, $property)) {
|
|
return $this->{$property}();
|
|
}
|
|
|
|
return e($this->model->{$property});
|
|
}
|
|
|
|
public function __call($method, $args)
|
|
{
|
|
return $this->model->$method($args);
|
|
}
|
|
}
|