ok
This commit is contained in:
21
Production/SNIPE-IT/app/Presenters/Presentable.php
Normal file
21
Production/SNIPE-IT/app/Presenters/Presentable.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Presenters;
|
||||
|
||||
trait Presentable
|
||||
{
|
||||
protected $presenterInterface;
|
||||
|
||||
public function present()
|
||||
{
|
||||
if (! $this->presenter || ! class_exists($this->presenter)) {
|
||||
throw new \Exception('Presenter class does not exist');
|
||||
}
|
||||
|
||||
if (! isset($this->presenterInterface)) {
|
||||
$this->presenterInterface = new $this->presenter($this);
|
||||
}
|
||||
|
||||
return $this->presenterInterface;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user