1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-30 15:35:09 +01:00
openstamanager/src/Traits/RecordTrait.php
2018-11-30 19:40:06 +01:00

36 lines
650 B
PHP

<?php
namespace Traits;
use Models\Module;
use Models\Plugin;
trait RecordTrait
{
public function getModule()
{
return !empty($this->module) ? Module::get($this->module) : null;
}
public function getPlugin()
{
return !empty($this->plugin) ? Plugin::get($this->plugin) : null;
}
public function uploads()
{
$module = $this->getModule();
$plugin = $this->getPlugin();
if (!empty($module)) {
return $module->uploads($this->id);
}
if (!empty($plugin)) {
return $plugin->uploads($this->id);
}
return collect();
}
}